Pages

Thursday, December 22, 2011

A text modifier script

The task was to
1. get the first letter of the second column and complete third column of a text file
2. convert everything to lower case
3. Combine them to form a single word

So I did the following

cat file1 | awk '{print $2}' | cut -c1 | tr '[A-Z]' '[a-z]' > first
cat file1 | awk '{print $3}' | tr '[A-Z]' '[a-z]' > second
paste first second | awk '{print $1$2} > merged

Monday, December 05, 2011

Adding hours in M$ excel

Some time you need to convert AM to PM in excel.
Then the following formula can come handy

If cell e5 contains time as 4:00 AM  Then

=e5+Time(12,0,0)  will return  16:00 hrs

similary you can do add and subtract operations on the time format in cell