How to trim strings using awk

To trim space inside an awk inline script, the following command does the job:

awk -F"|" '{gsub(/ *$/,"",$1);gsub(/^ */,"",$1); print $1}

Leave a Reply


imed.ws - Imed Bouchrika Website© 2003-2007.