I have field like
a_b_c_d I want as the output a b c_d, this query wont work for this
awk -F"_" <file> | '{print $1,$2,$3}' Since it will only print a b c
Try
awk -F"_" -f <file> '{ print $1" "$2" "$3"_"$4 }' In other words,
$echo a_b_c_d | awk -F"_" '{ print $1" "$2" "$3"_"$4 }' a b c_d The code in the brackets means
awk -F_ instead of awk -F"_".