Hello Anil, On Tue, Jun 20, 2006 at 03:36:49PM +0530, Anil Gupte wrote: | OK, I figured out the problem, but not the solution. The output is | actually from a SQL query. The output looks like this (when echoed): | | Serial_Number | TLO000003 | | It is getting the field name and the field value as two lines. So there is | a newline before the TLO000003 not a space. So I tried | Serial_Number=${Serial_Number#\n} and Serial_Number=${Serial_Number#\r} but | neither seemed to work. Any suggestions?
Perhaps there are additional characters in the output you cannot see. Try % echo -nE "${Serial_Number}" | od -c Note also that word splitting occurs (using IFS) if you leave off the double quotes (in the echo command but not in variable assignment). (Try the above echo command without the double quotes and notice the result.) See the EXPANSION section of the Bash man page for a discussion of the order of expansions. The sections on PARAMETERS and Word Splitting might also prove helpful. | In fact a better thing would be to get the result from mysql without the | field name - just the value as a string. Any ideas how? Perhaps using -B (tab-delimited output) and -N (suppress column header line) would help. Best regards, -- Zane Dodson -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]