Re: Can you explain this script ?
am 15.09.2007 21:12:40 von Ed Morton
apogeusistemas@gmail.com wrote:
> Hi:
> Can you explain this script ?
>
> #!/usr/bin/awk -f
>
> $0 !~ /^ / {
If (this record doesn't start with a space) {
> time = $1;
set the variable "time" to the value of the first field
> print;
and print the current record
> }
}
> $0 ~ /^ / {
If (this record starts with a space) {
> print time substr($0, length(time) + 1);
print the current record, replacing the first "length of string stored
in the variable time' characters by the value of "time".
> }
}
Ed.
Re: Can you explain this script ?
am 16.09.2007 00:04:59 von Bill Marcum
On Sat, 15 Sep 2007 18:37:39 -0000, apogeusistemas@gmail.com
wrote:
>
>
> Hi:
> Can you explain this script ?
>
> #!/usr/bin/awk -f
>
> $0 !~ /^ / {
> time = $1;
> print;
> }
>
If the first character in the input line is not a space, store the first
field in the variable "time".
> $0 ~ /^ / {
> print time substr($0, length(time) + 1);
> }
>
If the first character is a space, print the value of time, followed by
the rest of the line.
--
Indomitable in retreat; invincible in advance; insufferable in victory.
-- Winston Churchill, on General Montgomery