Hi,
This is how data in test.txt file
| |abc|zxcv|xy12|
| |cvs|zzvc|a23p|
How can remove first column.
abc|zxcv|xy12|
cvs|zzvc|a23p|
Thanks
srimitta
Hi,
This is how data in test.txt file
| |abc|zxcv|xy12|
| |cvs|zzvc|a23p|
How can remove first column.
abc|zxcv|xy12|
cvs|zzvc|a23p|
Thanks
srimitta
One way:
sed 's/^| |//' file > newfile
sed 's/^| |//' infile
Perfect it's working.
Thanks
srimitta
cat test.txt |cut -f3,4,5,6 -d'|'
---------- Post updated at 03:19 PM ---------- Previous update was at 02:59 PM ----------
How can this be achieved using awk?
awk '{sub(/\| \|/,"")}1' infile
awk -F'\| \|' '{print $2}' infile
awk -F'\| \|' '{$0=$2}1' infile
Thanks,
cat test.txt |awk '{sub(/\| \|/,"")}1'
Or:
cut -d\| -f3- infile
This should work too
cut test.txt -f3- -d'|'