Hi,
I want a awk script which will not print the last column of the line.
Say my input is
/usr/local/bin/gdb
/u/src/bin/ddd
I want the output to be
/usr/local/bin
/u/src/bin
awk -F/ '{for(i=1;i<NF;i++) {print "/"$i}}'
gives me
/usr
/local
/bin
/u
/src
/bin
I want them printed in one line at a time.
Any suggestions
Cheers,
Pravin.
I want a awk script which will not print the last column of the line.
Say my input is
/usr/local/bin/gdb
/u/src/bin/ddd
I want the output to be
/usr/local/bin
/u/src/bin
awk -F/ '{for(i=1;i<NF;i++) {print "/"$i}}'
gives me
/usr
/local
/bin
/u
/src
/bin
I want them printed in one line at a time.
Any suggestions
Cheers,
Pravin.