Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Answer: What is the simplest way to print a field, as in $3 does in awk

by projekt21 (Friar)
on Oct 23, 2001 at 15:47 UTC ( #120754=categorized answer: print w/replies, xml ) Need Help??

Q&A > strings > What is the simplest way to print a field, as in $3 does in awk - Answer contributed by projekt21

cat /etc/hosts | perl -ne 'print if (split(/\s+/,$_))[1] =~ localhost'

  • Comment on Answer: What is the simplest way to print a field, as in $3 does in awk
  • Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[stevieb]: it is a royal pita to have to disconnect a GPS serial pins every time I want to upload a code change to my Arduino...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2017-05-28 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?