I was recently working on a project where I had to provide the screenshot of /etc/security/passwd file. Even though the passwords on this file are encrypted, it was against the security policy to even expose that information. Earlier this information was redacted from the screenshots that was provided to the external entities (from the image file). But this didn't look like the effective way to do. So after researching different test processing tools available, I created this 'sed' one liner to mask the password fields from the /etc/security/passwd file while listing.
[/]> sed 's/\(password = \).*/\1[removed]/' /etc/security/passwd
root:
Password = [removed]
lastupdate = 1248123420
flags =
daemon:
Password = [removed]
bin:
Password = [removed]
sys:
Password = [removed]
adm:
Password = [removed]
uucp:
Password = [removed]
guest:
Password = [removed]
nobody:
Password = [removed]
lpd:
Password = [removed]
Hope this is helpful in same or different situations (or even different file - just use sed to replace text in a file)