Hi,
Can anyone please tell me about how we can delete an entire column from a tab delimited file?
Mu input_file.txt looks like this:
And I want the output as:
I used the below code
nawk -v d="1" 'BEGIN{FS=OFS="\t"}{$d=""}{print}' input_file.txt
But in the output, the first column is coming as NULL and then the remaining columns are printed.
Thanks
pamu
March 20, 2013, 8:03am
2
Try
while read a b c
do
print b c
done<file > out
or..
nawk 'BEGIN{FS=OFS="\t"}{sub($1FS,"")}1' input_file.txt
nawk '{$1="";print}' input_file.txt
Pamu,
Your code is working!
Can u please explain the command.
Thanks
anbu23
March 20, 2013, 8:38am
5
$ sed "s/[^[:blank:]]*[[:blank:]]//" file
Postcode Fund ISIN
TN16 9BE Franklin UK Mid Cap Fund A Inc GBP GB00B3ZGH246
BH15 2BX Templeton Global Bond A Mdis GBP H1 LU0316492692
The simplest solution is to use a tool that was designed precisely for this task. To "cut" out the first column:
cut -f2- file
Regards,
Alister