Gurus,
I have file contain following line.
,0113955056,,XAgent-Suspend
,0119418233,,XAgent-Suspend
,0102119078,,XAgent-Suspend
I want to make it one column file. How to do this using awk? Can anyone help with 'awk'
0113955056
0119418233
0102119078
awk -F, '{print $2}' file
Thanks. AWK and Cut both are fine.
However, i have several files: file1,file2,file3...etc. which contains 4 column.
How can I make all those files contain in one column and filename will be same, using ONE AWK command?
file1,file2 four column change into one column file1,file2.
for i in *;do awk -F, {print $2} $i > $i.bk; mv $i.bk $i; done
Note : mv command is used, so your original file will be replace with one column
1 Like
If you have GNU sed:
sed -ri.bak 's/,([^,]*$)?//g' infile*