sed script to manipulate the /etc/passwd file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed script to manipulate the /etc/passwd file
# 1  
Old 11-29-2009
Java sed script to manipulate the /etc/passwd file

Hi. Can anybody help me with a script to extract usernames, shell and home_directory from the /etc/passwd file.

I am stuck
# 2  
Old 11-29-2009
To extract the fields in that order:

Code:
cat /etc/passwd|awk -F: '{print $1,$7,$6}'

# 3  
Old 11-29-2009
You can eliminate the UUOC (for the unfamiliar - Useless Use of Cat)
Code:
awk -F: '{print $1,$7,$6}' /etc/passwd

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

nawk script to manipulate txt file

Hi experts, I am not familiarised using nawk/awk to manipulate txt file. So I need ur help here. thanks. txt1 - qc_m.log TQC101 TQC102 TQC103 TQC104 txt2 - resultEqpt.log TQC102,,LOGOFF TQC103,,LOGOFF TQC104,2012-10-03 07:42:57,LOGON so TQC101 is not found in txt 2. ... (15 Replies)
Discussion started by: ment0smintz
15 Replies

2. Shell Programming and Scripting

Manipulate columns using sed

Hello, I would like to remove the first column of lines beginning by a character (in my case is an open square bracket) and finishing by a space (or any other delimiter). For example: string1 string2 string3 to string2 string3 I found this previous topic: ... (1 Reply)
Discussion started by: stoyanova
1 Replies

3. Shell Programming and Scripting

Shell script to manipulate a file

Hello, I have a file with following contents : WSL SRVGRP=LISTENER SRVID=2 CLOPT="-A -t -- -n 0x0002aa050a03cc65 " RQPERM=0660 REPLYQ=Y RPPERM=0660 MIN=1 MAX=1 CONV=N I need to print only the value in Hex i.e.... (2 Replies)
Discussion started by: deo_kaustubh
2 Replies

4. Shell Programming and Scripting

Manipulating the etc/passwd file with sed

How can i use sed to extract the user name and home directory from the /etc/passwd/ file on my server. (11 Replies)
Discussion started by: Pauline mugisha
11 Replies

5. Shell Programming and Scripting

Manipulate lines with sed/awk

Hey All, I need to reorganize a file's text. Here is the source: host John_Doe filename "config.cfg"; hardware ethernet 98:10:3d:13:8f:98; fixed-address 10.10.10.29; } host Jane_Doe filename "config.cfg"; hardware ethernet 98:13:11:fd:5a:57; fixed-address 10.10.5.24; } host... (2 Replies)
Discussion started by: TheBigAmbulance
2 Replies

6. Shell Programming and Scripting

manipulate postscript via sed

dear all, on solaris10 for x86 i am trying to modify the creation date of a postscript file with sed in a csh script. sed is driving me crazy though...i think due to the spaces in the string i am trying to substitute?? part of the postscript file: %!PS-Adobe-3.0... (3 Replies)
Discussion started by: lada niva
3 Replies

7. Shell Programming and Scripting

RE or Sed to manipulate a document

I have a file with a list of about 2500 lines that I'd like to reformat using some regex in notepad++ or sed from my box (FreeBSD 6.3-RELEASE i386) to do the following: convert from: mycommand > mydocument0.htmlbcfn mycommand > mydocument1.htmlcdcsfn mycommand > mydocument2.htmldechfn... (6 Replies)
Discussion started by: phpfreak
6 Replies

8. Shell Programming and Scripting

Sed command to find, manipulate and replace a number

Hi, Im very new to the world of sed so I'm really not even sure if this is possible. What i need to do is read from a flat file and every time i see this line: VAL=123,456 I need to change 456 to 457 for every occurence of this line in the file. The numbers 123 and 456 are different for... (6 Replies)
Discussion started by: LT_2008
6 Replies

9. UNIX for Dummies Questions & Answers

using sed to manipulate text in files

Hi, I have a slight problem in trying to manipulate the text within a file using the "sed" command in that the text i need changed has "/" slashes in. I have a .sh script that scans the "/db/sybbackup/" directories for any .dmp file older than 2 days and then to >> the information to a file called... (3 Replies)
Discussion started by: Jefferson333
3 Replies

10. Shell Programming and Scripting

script to update gecos in passwd file

Hello, I need to add information in the gecos of each login in the passwd file. I have expect installed. I thought about using expect to to read a file with the login names and the gecos information and then execute the command passwd with the -f option. The other option would be to read... (1 Reply)
Discussion started by: jyoung
1 Replies
Login or Register to Ask a Question