Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Problems with formatting the results of my regex

by johngg (Abbot)
on Jul 07, 2012 at 11:07 UTC ( #980482=note: print w/replies, xml ) Need Help??

in reply to Problems with formatting the results of my regex

If your log files have CRLF line endings you can also open them for reading via the :crlf layer so that chomp will remove the carriage return as well as the line feed.

knoppix@Microknoppix:~$ hexdump -C xxx.crlf 00000000 4c 69 6e 65 20 31 0d 0a 4c 69 6e 65 20 32 0d 0a |Line 1..L +ine 2..| 00000010 4c 69 6e 65 20 33 0d 0a 4c 69 6e 65 20 34 0d 0a |Line 3..L +ine 4..| 00000020 4c 69 6e 65 20 35 0d 0a |Line 5..| 00000028 knoppix@Microknoppix:~$ perl -E ' > open $in, q{<:crlf}, q{xxx.crlf} or die $!; > while ( <$in> ) > { > chomp; > say qq{>$_<}; > }' >Line 1< >Line 2< >Line 3< >Line 4< >Line 5< knoppix@Microknoppix:~$

I hope this is helpful.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://980482]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2016-10-22 03:57 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (292 votes). Check out past polls.