Issue
How to get from a file exactly what I want in Linux?
I have: 123456789012,refid2141,test1,test2,test3
and I want this:
123456789012 or 123456789012 test3
.
Solution
$ echo "123456789012,refid2141,test1,test2,test3" | awk -F "," '{print $1}'
123456789012
$ echo "123456789012,refid2141,test1,test2,test3" | awk -F "," '{printf("%s, %s", $1,$5)}'
123456789012, test3
Answered By – Gonzalo Odiard
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0