Reputation: 401
I have a unix file something like this
Name : abc
Name : def
Value : 123
Value_old : 456
I want to print abc,def,123,456 only.I am using awk -F'' '{print $3}' file
but it is returning incorrect results.
Upvotes: 0
Views: 97
Reputation: 195029
awk -F'' '{print $3}'
won't work.
-F
is delimiter, here obviously, it should be :
$3
means column 3, in your input, there are only two columnsSo it should be awk -F':' '{print $2}'
There are many ways to get your input, like cut
in the other answer.
Also, grep:
grep -o '[^:]*$'
sed:
sed 's/[^:]*://'
Upvotes: 1