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

Re^2: add text to each line of a file

by ambrus (Abbot)
on Mar 10, 2005 at 22:04 UTC ( [id://438438]=note: print w/replies, xml ) Need Help??


in reply to Re: add text to each line of a file
in thread add text to each line of a file

Why use awk at all?

ypcat passwd | perl -wne '/:/ and print "$`\@domain.local\n";'
or
ypcat passwd | cut -d: -f1 | sed 's/$/@mydomain.local/'
or
ypcat passwd | sed 's/:.*/@domain.local/'

Replies are listed 'Best First'.
Re^3: add text to each line of a file
by smalhotra (Scribe) on Mar 14, 2005 at 22:37 UTC
    No! Not the dreaded $` I have trained myself so well to not use them that it now scares me to see it.

    $will->code for @food or $$;

Re^3: add text to each line of a file
by mw (Sexton) on Mar 30, 2005 at 11:50 UTC
    And to complete the sed:
    ypcat passwd |sed 's/:.*/@domain.local/'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-19 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found