I have a file in the following format:
col1|col2|col3|col4 a|b|c|d e|f||h i|j|k|l
I would like to delete col3 (with the delimiter \"|\") fr
Using cut is the right answer, but if you really want to use awk it's easier than Kent shows:
cut
awk
awk -F'|' 'BEGIN {OFS="|"} {for (n=3; n < NF; ++n) $n = $(n+1); --NF; print}'
Just shuffle the fields after $3 down, then by altering the value of NF you change the number of fields.
$3
NF