I\'m trying to remove leading and trailing space in 2nd column of the below input.txt:
input.txt
Name, Order Trim, working
Name, Order
Trim, working
just use a regex as a separator:
', *' - for leading spaces
' *,' - for trailing spaces
for both leading and trailing:
awk -F' *,? *' '{print $1","$2}' input.txt