in reply to One-liner (or few-liner) for massaging regexps?
Oh, you mean in perl...
The only problem with this is that what you replace isn't going to be the same width as what you removed, which could mess up columns.perl -pe's{(\d+)}{($1>1024)?(int($1/1024)):$1}eg;'
perl -pe's{(\d+)}{($1>1024)?(sprintf("%".length($1)."d",$1/1024)):$1}e +g;'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: One-liner (or few-liner) for massaging regexps?
by Aristotle (Chancellor) on Sep 17, 2002 at 21:28 UTC |