![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| replace single field out of 60 | ajp7701 | Shell Programming and Scripting | 2 | 04-21-2008 04:17 PM |
| awk: find and replace in certain field only, help needed | jkl_jkl | Shell Programming and Scripting | 5 | 02-21-2008 06:52 AM |
| Replace field in csv | pcboss | Linux | 4 | 01-19-2008 02:24 PM |
| how to replace field for each record | happyv | Shell Programming and Scripting | 12 | 06-26-2007 04:56 AM |
| Replace 10th Field by 2 | PradeepRed | Shell Programming and Scripting | 2 | 01-18-2006 11:46 PM |
|
|
LinkBack | Thread Tools | 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! |
| Forum Sponsor | ||
|
|
|
||||
|
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:
|
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|