[prev in list] [next in list] [prev in thread] [next in thread]
List: aix-l
Subject: Re: search and add...
From: Ray Schafer <schafer () TKG ! COM>
Date: 1999-02-25 3:47:49
[Download RAW message or body]
jistdc1@MAIL.JBHUNT.COM wrote:
> I need to add about 10-15 spaces AFTER an '='. Well, what I really
> want to do is aling everything up so it's so many spaces from the
> right, like:
>
> Agent.Daily.AccessDenials = 0
> Agent.Daily.ScheduledRuns = 0
> Agent.Daily.TriggeredRuns = 21
[...]
You could use awk.
awk '{printf ("%-39.39s%s ", $1, $2) # formats the first two fields
the way you want
for (i=3;i<=NF;i++) {
printf (" %s", $i) # prints all the rest of the fields with
a preceeding space
}
printf ("\n"); # ends with a newline
}' input_filename
The processing is done for each line.
Or you could use the Korn shell printf:
cat input_file | while read field equals rest
do
printf "%-39.39s %s %s\n" $field $equals "$rest"
done
I guess the shell looks easier...
--
Ray Schafer | schafer@tkg.com
The Kernel Group | Distributed Systems Management
http://www.tkg.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic