perlquestion
mimiandi
<p> Hello Monks -- quick question for ya guys
i thought i could slurp the whole file from command line using the following code, havent had any luck. wonder if can't do this from the commandline -- if i replaced the /n with // it shows up in one line but was wondering why it wouldnt work with undef $/ Thanks and Happy New Year! </p>
<code>
perl -e 'undef $/; $text=<>; print $text; $/="\n";' list
</code>
<p>
list contains the following information <br>
server1 ipaddress<br>
server2 ipaddress<br>
server3 ipaddress<br>
etc ..
<br>
graff: thanks -<br>
Went with the following to do what i wanted : <br></p>
<code>
perl -e 'undef $/; $text=<>; $text =~ tr/\n//; 1 while $text =~ s/\b(\w+\d+\s*\d+\.\d+\.\d+\.\d+)\s*\1\b/$1/ig; print $text; $/="\n"; list
</code>
<p>basically deletes the duplicates entries one after the other with "slurping"</p>