Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm changing the second field only like this :-nfs 1 active (followed by a variable number of words) tempfs 2 active (followed by a variable number of words) ufs 0 locked (followed by a variable number of words) . . and so on
This is giving me :-local @ARGV = ("diskmon"); local $^I = '.bak'; while (<>) { m/^(\w+)\s+(\d+)$/; printf "$1 %d %s\n", exists $disk{$1} ? 0 : $2+$partition; }
Whilst the second field has been changed as required, I've lost the rest of the record. I know I'm doing something dumb ??nfs 1 tmpfs 6 ufs 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: In place edit and printf
by japhy (Canon) on Dec 09, 2005 at 16:23 UTC | |
|
Re: In place edit and printf
by TedYoung (Deacon) on Dec 09, 2005 at 16:21 UTC | |
by ikegami (Patriarch) on Dec 09, 2005 at 16:47 UTC | |
by TedYoung (Deacon) on Dec 09, 2005 at 17:01 UTC | |
by Anonymous Monk on Dec 12, 2005 at 09:06 UTC |