Hi,
I need help in grabbing the value after comma from a comma separated file in linux.
Values in a file :
ABC,0
DEF,1
GHI,2
FJK,3
I need to grep value 0 if i pass ABC as a parameter to command.
i tried with grep 'ABC' filename | awk '{print $1}' but unsuccessful.
Could any one please help me.
Thanks in Advance.
Grep Command Help
Moderators: chulett, rschirm, roy
yes it should be unsuccessful since there's no FS specified.
try:
try:
Code: Select all
grep "ABC" filename|nawk -F, '{print $2}'
Code: Select all
pandeeswaran@ubuntu:~$ echo abc,0|grep abc|nawk -F, '{print $2}'
0
pandeeswaran