http://qs1969.pair.com?node_id=438438


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/'