AWK - Field Separator

October 6, 2018 at 11:31:25
Specs: Red Hat Enterprise 7, T5240

Why the command bellow doesnt show the output "hi opa" instead "aloha" ?

[root@es-cdrdecoder 20181005]# echo "ola aloha hi opa" | awk '{ if ($0 ~ /aloha/) {FS="aloha"; print $2 }}'

I need put the FS after if but always i do it, the field separator is space.

Remember, i need to use FS after if.


message edited by surfistadesampa

See More: AWK - Field Separator

Reply ↓  Report •
Related Solutions

Ask Question