1

Using sed to process passwd file

view story
linux-howto

http://unix.stackexchange.com – I am trying to learn sed, but I'm having a lot of trouble. What I am trying to do is process my passwd file using a bash script with sed commands to do the following: For every user with group ID 20000, replace their GID in the file with 2000x, where x is the order of the first letter in the user's username (ie: a is 1, b is 2, etc.) Also, for every user whose default shell is bash, change their group to bash, and for those with shell tcsh, change their group to tcshgroup. I have done the above work in awk (much easier to work with I've found), but I don't even know where to start with sed. An (HowTos)