i have a file in which data is like this
12 34 56 78
78 56 34 12
now i want to cut 2nd last column....
if 2nd column from start is to be cut then i can write
cut -d" " -f2 filename
what to do if 2nd column from end is to be cut !
any help
thanks
Sidhu
Do you have to use cut? awk will work very well here.
echo "12 34 56 78
78 56 34 12" | awk '{print $(NF-1)}'
is there any way we can do it with cut ?
also with awk if i need to read from file then how m going to do it...couldnt get a clue...actually touching linux after long time
try this
cat file_name | awk '{print $(NF-1)}'
thanks :o
it is perfect !