However, if the OP wanted to actually truncate $FOO to 51
characters:

NEWFOO=$( echo "$FOO" | awk -v max=51 '{print substr($0,0,max)}' )

You don't need all that for a simple truncation/substring, you can do it with a direct assignment:

newfoo=${foo:0:51}

The three params here are "variable", "start position" and "length".

______________________________________
it has a certain smooth-brained appeal
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to