in reply to Clean Up downloaded "messy" script?
Your specification of 'first 3 characters are whitespaces and/or a number followed by ":"' is a bit conflicting - does that include 3 whitespaces followed by a number? should 3 whitespaces be followed by a colon? - but here's the best match I can come up with for that description (I'm guessing the answer to both of the above is "no"):
#!/usr/bin/perl -w use strict; # Build a regex of "\d\d\d:|\s\d\d:|\s\s\d:|\s\s\s" my $str = join ":|", map { '\s'x$_ . '\d'x(3-$_) } 0 .. 3; while (<>){ s/^$str//; # Remove anything that matches regex from start of line print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Clean Up downloaded "messy" script?
by matze77 (Friar) on Dec 20, 2008 at 14:52 UTC |