Thursday, September 12, 2013

Awk trick

Awk trick 1


>>-- 12 September 2013 --<<

To to search a pattern of 31 and 39 in a big file at 155 to 157 position, and need to save the results in separate files with search pattern name

Use below comment

awk '{p=substr($0,155,2)} p ~ "3[19]" {print > p ".txt"}' file


Thanks
~ aks

No comments:

Post a Comment