Wednesday, March 24, 2010

sed & awk

Split the line with field separator ".", and restructuring again
awk -F. '/stbdbp/{ print $2"."$3"."$4"."$5".Z"}' ./list.txt
 
Insert "go" to the next of every lines from test_new.log
sed '1,$ {
        a\
go
}' test_new.log
 
Remove the line which contains "#" from test_new.log
sed '/#/d' test_new.log
 
Remove blank line from test_new.log
sed '/^[ ]*$/d' test_new.log