nv-l

AW: assigning variables in a script

1999-01-20 05:38:54
Subject: AW: assigning variables in a script
From: FITZINGER Richard <richard.fitzinger AT CAIT.CO DOT AT>
To: nv-l AT lists.tivoli DOT com
Date: Wed, 20 Jan 1999 11:38:54 +0100
Lucy,
if you know about the number of blanks you want to get rid of, use:

variable=${variable#                       }

type in the exact amount of blank spaces after the # sign.

I know that there is a possibility to remove leading blanks up to or
including a letter. More about this straight after I will find that Korn
Shell book that must be somewhere round here...

regards, Richard

iT-AUSTRIA
TK/Netzwerk-Management
Lassallestr.5
A-1020  Wien
Tel.: (+43 1) 21717-58944
Fax.: (+43 1) 21717-58979
eMail: richard.fitzinger AT it-austria DOT com

> ----------
> Von:  Lucy Premus[SMTP:lpremus AT METLIFE DOT COM]
> Gesendet:     Dienstag, 19. Januar 1999 16:30
> Betreff:      assigning variables in a script
>
> Okay.  I have another question regarding variables and scripts.  But
> before
> I ask this one, just wondering if anyone knows the answer to my previous
> question?.  How do you remove preceding spaces in a variable?  Meaning if
> I
> have a variable that looks like this
> '                           TRUE', but all I really need is just the word
> TRUE.  How do I get rid of the spaces before the word?
>
> My other question is if my script is reading a text file and processing
> each line, how do I parse out each word on that line and assign it to a
> variable?  For example, the line looks like this:   'resourcename Jan 15
> 10:00:00 EST 1999' and I just want to capture 'resourcename' and assign it
> to one variable and capture  '10:00:00' and assign it to another variable.
>
> BTW....In case anyone is wondering, I do have a Korn Shell programming
> book, but I can't seem to find this information in there.  I'm sure its
> there, in some form, but is it english?   Thanks for all the
> help..................Lucy
>

<Prev in Thread] Current Thread [Next in Thread>
  • AW: assigning variables in a script, FITZINGER Richard <=