Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: $/ usage

by mimiandi (Novice)
on Jan 02, 2013 at 21:54 UTC ( #1011362=note: print w/replies, xml ) Need Help??


in reply to Re: $/ usage
in thread $/ usage

"in its original form" - i was expecting to see something like this: server1 ip server2 ip server3 ip etc..
I was going to do another pattern match on the string $text after getting it in the string.

perl -e 'undef $/; my $text=<>; 1 while $text =~ s/\b(\w+\d+)\s*\1\b/$ +1/gi; pring $text; $/="\n";' list

Replies are listed 'Best First'.
Re^3: $/ usage
by graff (Chancellor) on Jan 02, 2013 at 22:44 UTC
    To get all the lines from a slurped input file to show up as a single line on output, you want something like this:
    perl -e 'undef $/; $_=<>; tr/\n/ /; s/ $/\n/; print' list
    Or you could just use unix/linux commands that do the same thing:
    xargs echo -n < list
    (If you want a clean line break at the end of that output, add  && echo at the end.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011362]
help
Chatterbox?
[Tux]: choroba++ # pm_cb_g also signals replies to posts, something#cbstream does not
[marto]: good afternoon all
[marto]: that is a neat feature, I'll have to have a look at how it displays that
[Tux]: 14:32 Europe/Amsterdam, so good afternoon to you :)
[marto]: 13:32, sunny Glasgow :P

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2017-09-22 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (262 votes). Check out past polls.

    Notices?