Quote:
Originally posted by uribo
hi moses,
one question --> how can i update shadow file after insert "*" in "mark" field?
i tried:
cat /etc/shadow | awk -F: '{ if ($1 == "mark") print $1FS"*"FS$3FS$4FS$5FS$6FS$7FS$8FS}' > temp.doc && mv temp.doc /etc/shadow
& it replace the whole file content with only "mark" entry.
thanks
|
To be honest, I think my "solution" is really quite ugly and though it works you should look for something more elegant (this was just a quick response answer)
Anyway, you are almost there. . .
Code:
awk -F: '{if ($1 == "mark") $2 = "*"} { print $1FS$2FS$3FS$4FS$5FS$6FS$7FS$8FS}' shadow
This is still ugly and if I bothered to read the manual page I could find the right way to do it, but I'm too lazy.