Reputation: 1425
given a file with two columns, separatedly by standard white space
a b c d f g h
how do I output the second column
Upvotes: 21
Views: 63362
Reputation: 43688
Use cut with byte offsets:
cut -b 3
Use sed to remove trailing columns:
sed s/..//
Upvotes: 2
Reputation: 14149
Because the last line of your example data has no first column you'll have to parse it as fixed width columns:
awk 'BEGIN {FIELDWIDTHS = "2 1"} {print $2}'
Upvotes: 14