remove last field using awk code example Example: remove last field using awk awk 'NF{NF-=1};1' <in >out