Wednesday, September 2, 2015
PL SQL Gems
Tuesday, September 1, 2015
Monday, June 15, 2015
Visiting Jurassic World!
Will be watching the much awaited movie tomorrow, getting the same feeling that I got as a kid before the show for the original Jurassic Park..
Sunday, May 17, 2015
UNIX Gem 3: How to display, segreggate file types:
>file filename.txt
file *
speech-dispatcher: directory
ssh: directory
ssl: directory
sudoers: regular file, no read permission
sudoers.d: directory
sysctl.conf: ASCII English text
sysctl.d: directory
systemd: directory
terminfo: directory
thunderbird: directory
timezone: ASCII text
ts.conf: ASCII text
ucf.conf: ASCII English text
udev: directory
ufw: directory
updatedb.conf: ASCII text
update-manager: directory
Sunday, May 10, 2015
Unix gem: Truncating file
We know how to truncate a table in SQL,i.e. retain the structure of the table removing the contents of the table.
In UNIX ,lets say we want to remove the contents of the file and retain the empty file (zerobyte file). How can we achieve this.
➡ One way is to delete the file completely and recreate it.
➡The second method is to open the file using an editor such as vi and delete each line and save.
But what if we want to truncate the file on the fly?
Consider the problem statement:
Check if the file called dataflow has been sent by upstream and count the number of records. If records exceed threshold (value of 10,000) truncate the file and FTP it to the remote server indicating threhold breach-incorrect records. Else FTP the file as it is.
UNIX has a command for this:
We can use
cat >dev >null dataflow
This would make the file zero byte
A simple hueristic for the above problem will be
If exists file then
If
wc -l dataflow gt threshold
cat >dev >null dataflow
Ftp servername (pick credentials from .netrc)
Put dataflow
Bye
Else
Ftp file intact.
Unix Gems
In the next posts time and time I will brush up some important Unix related stuff that can be used as a quick reference. These are some important commands,info that are dug from the grounds of Unix. And hence gems

