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

No comments:

Post a Comment