1
votes

I have tried batch 'for loops', and Linux AWK. Both seem to have the same issue, where they ignore empty entries in a tab delimited file. I try to print the 32nd column, but because some previous entries have nothing between two tabs, it creates problems.

Is there a workaround for this? Or any other language you recommend for this?

Col1            Col3    Col4
Col1    Col2    Col3    Col4
1
post the actual input fragment - RomanPerekhrest
For some reason, the tabs are showing as spaces, but imaging there are 2 tabs between Column 1 and 3 on the first row. Everything else is 1 tab. Try to print column 3 - thisisnice05
you wrote print the 32nd column, post the actual few lines containing all columns and expected result for those lines - RomanPerekhrest

1 Answers

0
votes

Tell awk that your field separator is a tab using the -F option. Example to print the third column with your example:

$ cat foo.txt
Col1            Col3    Col4
Col1    Col2    Col3    Col4
$ awk -F '      ' '{print $3}' foo.txt
Col3
Col3