[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Scripting question



On Tue, 2006-06-20 at 15:36 +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?
> 
> 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?
> 
> Thanx again.
> Anil Gupte

If this is the only output, you may try this:
<your query> |grep -v Serial_Number

Or this:
<your query> --disable-column-names

> www.keeninc.net
> www.icinema.com
> 
> ----- Original Message ----- 
> From: "Hal Vaughan" <hal@thresholddigital.com>
> To: <debian-user@lists.debian.org>
> Sent: Monday, June 19, 2006 11:00 PM
> Subject: Re: Scripting question
> 
> 
> > On Monday 19 June 2006 13:00, Anil Gupte wrote:
> >> Why does
> >>
> >> echo /l3dat/${Serial_Nuumber}.tar.gz
> >>
> >> give me
> >>
> >> /l3dat/ TLO00003.tar.gz
> >>
> >> In other words, why is it putting an etra space in there (after the
> >> second /) and how can I get rid of it?
> >>
> >> And yes, there is no space there.  I checked by using
> >>
> >> Serial_Number=${Serial_Number##" "}
> >
> > Have you tried concatenating two strings?  Starting with:
> >
> > tdir=/l3dat/
> > tfile=${Serial_Number}.tar.gz
> >
> > then concatenated them?
> >
> > If that works, great, if you still get a leading space on tfile, try:
> >
> > tfile=${tfile# }
> >
> > AFTER you've set $tfile.  It's a regex that will eliminate a leading
> > space.
> >
> > Hal
> >
> >
> > -- 
> > To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> > with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> >
> > 
> 
> 
-- 
Szia:
                        Nyizsa.



Reply to: