Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Perl equivlanet of simple awk

by repellent (Priest)
on Mar 19, 2011 at 22:19 UTC ( [id://894195]=note: print w/replies, xml ) Need Help??


in reply to Perl equivlanet of simple awk

This equivalent on the command line:
perl -alne 'print $F[1] if /user\@example.com/' /home/bob/db.txt

See Command Switches.

Expanded code:
use warnings; use strict; open my $FH, '<', '/home/bob/db.txt' or die $!; while (local $_ = <$FH>) { chomp; print((split ' ')[1], "\n") if /user\@example.com/; }

Update: Added expanded code.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found