Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert new line 1

Status
Not open for further replies.

kHz

MIS
Dec 6, 2004
1,359
US
This has probably been addressed before, but I couldn't find the answer if a brief search.

This is a snippet of my nsswitch.conf file:
# the following two lines obviate the "+" entry in /etc/passwd and /etc/group.
passwd: files ldap
group: files ldap

# consult /etc "files" only if ldap is down.
hosts: files dns

What I want is to add a line AFTER passwd: files ldap that would look like:
passwd: files ldap
passwd_compat: ldap [tryagain=continue] #the space after the colon is a tab
group: files ldap

Thanks!
 
awk '
{print}
/^passwd:/{print "passwd_compat:\tldap [tryagain=continue]"
' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top