naresh
Answered On : May 2nd, 2012
cat file_name | awk {print $n} # where N is the column no. and tab is field seperator
cat SO_02052012_2.csv | awk -F; {print $n} # where N is is column no. and semicolon is field seperator
Login to rate this answer.
ardiansyah
Answered On : Jul 5th, 2012
awk {print $n} < filename
where n is the field number
Login to rate this answer.
Rudy
Answered On : Aug 2nd, 2012
Question is without using awk commands, any idea ??????
Login to rate this answer.
Sijeesh KT
Answered On : Aug 18th, 2012
perl -ane print "$F[0]"; < test.txt
You can use this I hope , replace the zero with the column number you want to print.Normally people use cut and awk command for extracting column.
Login to rate this answer.
santarvedi
Answered On : Oct 30th, 2012
i think by modifying the IFS, we can achieve this as follows, i hope this helps.
#take for example there is an entry in /etc/password with this info
santarvedi:x:500:500:santarvedi:/home/santarvedi:/bin/bash
#let me extract my 6th column, ie, my home directory (/home/santarvedi) using the following mode.
santarvedi]$ bk_IFS=$IFS
santarvedi]$ IFS=:
santarvedi]$ set -- $(getent passwd santarvedi)
santarvedi]$ echo $6
santarvedi]$ IFS="$bk_IFS"
Login to rate this answer.