user2601570 user2601570 - 1 month ago 12
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
comission
only

Answer

This will also work

    echo 'Francis:8:98765432:commission' | cut -d: -f4