How to manipulate text lines and Create two separate files for odd and even ?
file 1:
iitmc01n01 iitmc01n03 . . iitmc01n71
file 2:
iitmc01n02 iitmc01n04 . . iitmc01n72
Advertisement
Answer
I’d say
awk '/[13579]$/ { print > "file1"; next } { print > "file2" }' inputfile
This will print lines in inputfile
that end with 1, 3, 5, 7, or 9 to file1
and all others to file2
.