Timeline for Can't use tab completion when using awk in command line
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 10, 2016 at 12:37 | comment | added | Valentin B. | To answer your question you don't need to set FS and OFS inside the awk instructions, but apparently the presence of \t in your command line seemed to confuse your inline shell editor. You could also try $ myFS='\t'; awk -F"$myFS" -v OFS="$myFS" ..., it might work. | |
| Oct 10, 2016 at 12:35 | comment | added | Valentin B. | I'm not quite sure what happened when you passed the FS value through the -v option, but using the -v option should be used primarly when you want to pass a value that is contained in a shell variable, like : $ awk -v x=$someValue ... if your value is a constant, you can initialize it in a BEGIN block. Anything in such a block in awk will be executed before going through the file. Similarly, there is an END block that is executed once all the file has been read. You can set field separator (FS) and output field separator (OFS) in any block. | |
| Oct 10, 2016 at 8:04 | comment | added | Yichao Cai | Thank you so much! That actually works and the result is correct. Is it necessary to include the file delimiter option in the apostrophes? | |
| Oct 7, 2016 at 8:37 | history | answered | Valentin B. | CC BY-SA 3.0 |