There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
A simple regex works fine, but transliteration is often more efficient. Here's an approach with tr///. This snippet iterates over each line of each file supplied at the command prompt, and prints the filename and line number, along with a highlighted version of the line's data showing where the problems are:
This would be invoked as: $ ./nonimo.pl filename1.txt filename2.txtIt could be expressed as a one-liner, in fact, like this:
The output is a little more terse, but it does the same thing. In either case, if your objective is just to print the bad lines, you can easily simplify the print statement. Dave In reply to Re: what regular expression do I need?
by davido
|
|