I need to set awk field separator to ";", but I need to avoid ";EXT".
so that
echo a;b;c;EXTd;e;f | awk -F";" '{print $3}'
would give "
c;EXTd
"
I need to set awk field separator to ";", but I need to avoid ";EXT".
so that
echo a;b;c;EXTd;e;f | awk -F";" '{print $3}'
would give "
c;EXTd
"
As far as I know its not possible.
Setting FS is a global parameter.
You may try other solution, like split an join it after, like
echo "a;b;c;EXTd;e;f" | awk -F";" '{print $3";"$4}'
c;EXTd
You may using IF/THEN
and locate the EXT if its not in same location and then join it if found.
$ echo 'a;b;c;EXTd;e;f' | sed 's/;EXT/�/g; s/;/|/g; s/�/;EXT/g' | awk -F\| '{print $3}'
c;EXTd