sed to add text in new line

help

i need to add a "nfsd" in new line after cron

ex:

cron
rpcbind

output:

cron
nfsd
rpcbind

i use

sed -e "/cron/G; s/$/nfsd/" myfile

output:

cron
nfsd
rpcbindnfsd

help!!!

try:

sed "/cron/n;i nfsd" myfile

rdrtx1's solution will work only on GNU sed, if you do not have it then use awk:

awk '$0=="cron"{$0=sprintf("%s\n%s",$0,"nfsd");}1' filename

try this

sed 's/\(cron\)/\1\nnfsd/g' filename
 
$ sed 's/cron/cron\
nsfd/' input.txt
 

type \ and press enter and type nsfd....

thx all...
awk is working ..

 
awk '$0=="cron"{$0=sprintf("%s\n%s",$0,"nfsd");}1' filename
 
awk '$0=="cron"{$0=sprintf("%s\n%s",$0,"nfsd");}1' filename>filename1 

love U all | warpiece