02-25-2008
awk/sed/ksh script to cleanup /etc/group file
Many of my servers' /etc/group file have many userid's that does not exist in /etc/passwd file and they need to be deleted.
This happened due to manual manipulation of /etc/passwd files.
I need to do this for 40 servers.
Can anyone help me in achieving this? Even reducing a step or two will be greatly appreciated.
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies
2. Shell Programming and Scripting
Hello all, I'm working on an attendance callout script for a school district. I need to change our current layout for the vendor. Currently the data is in the form of:
studentid,period,building,
Heres a sample of some made up records:
500,1,30,
500,2,30,
500,3,30,
500,6,30,... (7 Replies)
Discussion started by: axo959
7 Replies
3. Shell Programming and Scripting
Hello,
Could some expert soul please help me with this? I have following file format -
task time
abc 5
xyz 4
abc 5
xyz 3
ddd 10
ddd 2
I need to generate output as -
task ... (5 Replies)
Discussion started by: sncoupons
5 Replies
4. Shell Programming and Scripting
Hi,
I've the following two CSV files:
File1.csv File2.csv
Class,Student# Student#,Marks
1001,6001 6002,50
1001,6002 6001,60
1002,7000 ... (3 Replies)
Discussion started by: Matrix2682
3 Replies
5. Shell Programming and Scripting
Hi,
I've a file like below:
DeptFile.csv
DeptID EmpID
------- ------
Dep01 Emp01
Dep01 Emp02
Dep01 Emp03
Dep02 Emp04
Dep02 Emp05
I've another file which has
EmpFile.csv
EmpID Salary
------ ------ (3 Replies)
Discussion started by: Matrix2682
3 Replies
6. Shell Programming and Scripting
I found some posts describing how to completely clean out a mailbox in Unix/Linux. But I want to keep the 50 most recent messages. Any ideas out there?
Thanks! (3 Replies)
Discussion started by: OPTIMUS_prime
3 Replies
7. Shell Programming and Scripting
Links Please??? (2 Replies)
Discussion started by: Diddy
2 Replies
8. Shell Programming and Scripting
Hi Gurus,
I am working with a korn shell script. I should replace in a very great file the character ";" with a space.
Example:
2750;~
2734;~
2778;~
2751;~
2751;~
2752;~
what the fastest method is? Sed? Awk?
Speed is dead main point, Seen the dimensions of the files
Thanks (6 Replies)
Discussion started by: GERMANICO
6 Replies
9. Shell Programming and Scripting
Hi gurus,
I have data coming in as shown below. And in each case, I need to pick the data in the last group as shown below.
Data Set 1:
DC | 18161621
LA | 15730880
NY | 16143237
DC | 18161621
LA | 17316397
NY | 17915905
DC | 18161621
LA | 17993534
NY | 18161621
DC | 18161621... (11 Replies)
Discussion started by: calredd
11 Replies
10. UNIX for Beginners Questions & Answers
Hi I want to use sed to change a text files input into an awk script.
For example if the input says " chord -- english " I want to change this using sed 's/pattern 1 /pattern 2 /'g filename but I don't understand how to use part of the pattern 1 to input that into pattern 2 . Like after... (10 Replies)
Discussion started by: enforcer
10 Replies
vipw(8) System Manager's Manual vipw(8)
NAME
vipw,vigr - edit the password, group or shadow file
SYNOPSIS
vipw [-g|-p|-s]
vigr [-g|-p|-s]
DESCRIPTION
vipw/vigr edits the passwd,group or shadow file after setting the appropriate locks to prevent file corruption. vipw edits per default the
/etc/passwd file, vigr the /etc/group file. Extended attributes (like ACLs or security attributes) are preserved.
ENVIRONMENT
EDITOR If the environment variable exists, the editor specified by this variable is used instead of the default vi(1).
OPTIONS
-g, --group
Edit /etc/group.
-p, --passwd
Edit /etc/passwd.
-s, --shadow
Edit /etc/shadow.
-u, --usage
Print a usage message and exit.
--help
Print a more verbose help text and exit.
Print version information and exit.
FILES
/etc/group - group account information
/etc/passwd - user account information
/etc/shadow - shadow account information
SEE ALSO
attr(5), passwd(1), passwd(5), shadow(5), vi(1)
AUTHOR
Thorsten Kukuk <kukuk@suse.de>
pwdutils October 2003 vipw(8)