![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| replace single field out of 60 | ajp7701 | Shell Programming and Scripting | 2 | 04-21-2008 07:17 PM |
| awk: find and replace in certain field only, help needed | jkl_jkl | Shell Programming and Scripting | 5 | 02-21-2008 10:52 AM |
| Replace field in csv | pcboss | Linux | 4 | 01-19-2008 06:24 PM |
| how to replace field for each record | happyv | Shell Programming and Scripting | 12 | 06-26-2007 07:56 AM |
| Replace 10th Field by 2 | PradeepRed | Shell Programming and Scripting | 2 | 01-19-2006 03:46 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Replace password field using ed/sed
I need to edit the password file to change the password field to *LK* for a specified account (abctest) like:
abctest:*LK*:135:20::/home/abctest:/sbin/sh Can anyone help me do this using ed or sed? Thanks a lot! |
|
|||||
|
Quote:
eg users: user2 and user23 projectuser234 , using user2 will lock all three. Code:
awk 'BEGIN{IFS = OFS = ":"} $1 == "youruser" { $2 = "*LK*" } { print }' /etc/passwd
|
|
||||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|