![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help to replace character strings | rahulrathod | UNIX for Dummies Questions & Answers | 5 | 12-18-2008 05:26 AM |
| replace 2 identical strings on different lines | prkfriryce | Shell Programming and Scripting | 3 | 06-15-2007 12:18 PM |
| Put strings around the file name | Jolly | UNIX for Advanced & Expert Users | 3 | 05-09-2007 08:32 AM |
| Please Help. Strings in file 1 need to be searched and removed from file 2 | mjs3221 | Shell Programming and Scripting | 4 | 08-18-2006 04:13 PM |
| How to concatenate two strings or several strings into one string in B-shell? | fontana | Shell Programming and Scripting | 2 | 08-26-2005 12:58 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
replace strings in a file
Hi
I want to change the following passwd: files nis group: files nis in /etc/nsswitch.conf to be passwd: files compat group: files compat I tried cp -p nsswitch.conf nsswitch.conf.old sed -e 's asswd\: files nis asswd\: files compat:g' -e 's:group\: files nis:group\: files compat:g' nsswitch.conf.old > nsswitch.confIt only changes passwd not group: passwd: files compat group: files nis could you please advise? thank you |
|
||||
|
I tried this
cp -p nsswitch.conf nsswitch.conf.old sed -e '/<passwd>/!s/passwd\(.*\)/passwd\: files compat/' \ -e '/<shadow>/!s/shadow\(.*\)/shadow\: files compat/' \ -e '/<group>/!s/group\(.*\)/group\: files compat/' \ nsswitch.conf but this changes also netgroup: files nis to netgroup: files compat |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|