user2601570 user2601570 - 1 year ago 110
Bash Question

ubuntu linux shell scripting with command line grep and split delimiter

i have this line :

S=`cut -d: -f4 | grep $name info.txt`;

then i display by

echo "$S";

It display nothing.

grep $name info.txt
;` gives me output :

Francis:8:98765432:commission // this is a line from my textfile separated by :

i am trying to display

Answer Source

This will also work

    echo 'Francis:8:98765432:commission' | cut -d: -f4
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download