Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to grep some string(IP:port) from text file and print into txt file

by hippo (Bishop)
on Mar 03, 2017 at 09:18 UTC ( [id://1183534]=note: print w/replies, xml ) Need Help??


in reply to How to grep some string(IP:port) from text file and print into txt file

I was going to suggest that this

perl -lane 'print $F[1] if $. < 5;' test.txt

will perform to the spec. However I then noticed that for some reason you didn't want the 4th line of input to match and I cannot spot why that would be the case. Perhaps there is an error in your spec? Consider How to ask better questions using Test::More and sample data.

  • Comment on Re: How to grep some string(IP:port) from text file and print into txt file
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-20 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found