I am trying to separate a tab-delimited file using awk.
awk -F'\t' -v OFS="\t" '{if ($5=="Pattern") print $0}' My_file
I came into problem that I can't not use tab completion with the option " -v OFS="\t" ". Whenever the command contain " -v OFS="\t" "(whether it is the only option or in combination with other option), I can not use tab completion for filename.
When I use:
awk -F'\t' '{if ($5=="Pattern") print $0}' My_file
The tab completion works fine.
And sometimes when I use the following command:
awk -v OFS='\t' '{if ($5=="Pattern") print $0}' My_file
There will be error:
bash: unexpected EOF while looking for matching `''
bash: syntax error: unexpected end of file
When I paste the filename, but not by tab completion, the command actually works.
Can anyone tell me what I am been doing wrong?
Thank you!
awk -v 'OFS="\t"; {if ($5=="Pattern") print $0}'
, the tab completion works fine. But it raise another error "awk: 1: unexpected character '.'", if the file name contain ".". I rename the filename with no ".", but now the command takes a long time to run(which it shouldn't be) and I kill it with ctrl+c.