A question for the AWK wizards

2006-07-25 Thread Murray Taylor
Hi all, I have a shell script which is called with an arbitrary message argument. Punctuation excludes * ? | chars. It processes it via an AWK command line 'script' and dumps the result in a file for the SMS sender... Nice and simple. Except that the AWK script seems to duplicate the last

Re: A question for the AWK wizards

2006-07-25 Thread Giorgos Keramidas
On 2006-07-25 21:43, Murray Taylor [EMAIL PROTECTED] wrote: Hi all, I have a shell script which is called with an arbitrary message argument. Punctuation excludes * ? | chars. It processes it via an AWK command line 'script' and dumps the result in a file for the SMS sender... Nice and

Re: A question for the AWK wizards

2006-07-25 Thread Parv
in message [EMAIL PROTECTED], wrote Murray Taylor thusly... # generate the sms message # the awk code forces the message to be 160 chars ... tmpfile=`mktemp -t sms` echo ${phone} ${tmpfile} ${AWK} '{ printf %-0.159s, $0 }' ${tmpfile} EOF2 `echo $msg` EOF2 As it is, any line

Re: A question for the AWK wizards

2006-07-25 Thread David Kelly
On Tue, Jul 25, 2006 at 10:51:02AM -0400, Parv wrote: As it is, any line longer than 159 characters will just overflow. You need to use substr() not awk to shorten a line. Even after that modification, that won't solve your actual problem as the awk script will just shorten EACH line (when

Re: A question for the AWK wizards

2006-07-25 Thread Parv
in message [EMAIL PROTECTED], wrote Parv thusly... You need to use substr() not awk to shorten a line. ` ^ ^ ^ ^ ^ ^ ^ ^ ` ^ ^ ^ ^ ^ ^ ^ ^ Dang it! I meant to use the substr() function in awk. - Parv -- ___