in reply to Using -i in oneliner with postprocessing
When I think of postprocessing, I usually think of END blocks. Does this work for you?
perl -i.bak -nwe '$h{$_} = length; END { print sort { $h{$a} <=> $h{$b} } keys %h; }' \ file1 file2 ...
Oh, duh, just read your query a bit closer. Yeah, that's a stinker that it closes the file on you. And your solution is nifty (although the weirdly-matched braces scare me a bit).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using -i in oneliner with postprocessing
by QM (Parson) on Apr 28, 2004 at 14:56 UTC | |
by tkil (Monk) on Apr 28, 2004 at 18:10 UTC | |
by QM (Parson) on Apr 29, 2004 at 17:33 UTC |