Filter passwd


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filter passwd
# 8  
Old 01-04-2005
Quote:
Originally posted by Perderabo
Hmmm...I guess Ygor had a typo...

awk -F: '$2 !~ "\*"' file
When it works, great! Looks fine (but I'm not a awk specialised, you know ;-)
I will test it tomorrow.

Regards,
Martin
# 9  
Old 01-04-2005
$ cat file1
otto:***LOCKED***:....
Sven:7hfd7ihd7fd:....
Mueller:*:....
Tanja:ukjs7i437jd:....
Klaus:*TTT*:
$ awk -F: '$2 !~ "\*"' file2
awk: 0602-521 There is a regular expression error.
?*+ not preceded by valid expression.

The source line number is 1.
The error context is
$2 !~ >>> "\*" <<<
$ awk -F: '$2 !~ "*"' file2
awk: 0602-521 There is a regular expression error.
?*+ not preceded by valid expression.

The source line number is 1.
The error context is
$2 !~ >>> "*" <<<
$ uname -a | cut -d" " -f 1,3-
AIX 3 4 0001BA0F4C00
# 10  
Old 01-04-2005
Mine was tested and works on HP-UX 11i. I guess the exact syntax varies from system to system.
# 11  
Old 01-04-2005
Indeed - I think something like

awk -F: '$2 !~ /\*/' file

should solve most syntactical woes - does on my Linux boxes anyway!

EDIT:
Anyway - I'd use my friend sed! Smilie (only tested on Linux and UNICOS 9.0 this evening...)
Code:
sed '/^[^:]*:[^:]*\*[^:]*:.*$/d' my_passfile

I get the expected output of (using sample data) of...
Sven:7hfd7ihd7fd:Comment ***! :
Tanja:ukjs7i437jd:No Asterix here:


Cheers
ZB

Last edited by zazzybob; 01-04-2005 at 06:23 PM..
# 12  
Old 01-05-2005
Quote:
Originally posted by zazzybob
Indeed - I think something like

awk -F: '$2 !~ /\*/' file

should solve most syntactical woes - does on my Linux boxes anyway!

I get the expected output of (using sample data) of...
Sven:7hfd7ihd7fd:Comment ***! :
Tanja:ukjs7i437jd:No Asterix here:


Cheers
ZB
Great, I also get the needed output.
I should learn moe about the great tool awk ...

Martin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Filter records in a huge text file from a filter text file

Hi Folks, I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file. bash scripting is what i need. Data.txt Name OrderID Quantity Sam 123 300 Jay 342 498 Kev 78 2500 Sam 420 50 Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies

2. AIX

When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?

Does anyone know when AIX started using /etc/security/passwd instead of /etc/passwd to store encrypted passwords? (1 Reply)
Discussion started by: Anne Neville
1 Replies

3. UNIX for Dummies Questions & Answers

etc/passwd help

Hi! i've been searching a way to display the users who are in the /etc/passwd directory...using ls or grep or cat command should do it?i can't find a way to get this right..i mean none of the preview commands function sounded good to me to use... (9 Replies)
Discussion started by: strawhatluffy
9 Replies

4. UNIX for Dummies Questions & Answers

passwd

Hello , how to open utemp,getpwuid files.I know what info these files will carry but i dont know ow to open see the info present in it. Thanks to help. (4 Replies)
Discussion started by: kkalyan
4 Replies

5. Solaris

passwd cmd reenables passwd aging in shadow entry

Hi Folks, I have Solaris 10, latest release. We have passwd aging set in /etc/defalut/passwd. I have an account that passwd should never expire. Acheived by emptying associated users shadow file entries for passwd aging. When I reset the users passwd using passwd command, it re enables... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

6. Shell Programming and Scripting

/etc/passwd

Hello All I want to print only the full name from the /etc/passwd file and print it to the screen . Could you please let me know how can I do that? (4 Replies)
Discussion started by: supercops
4 Replies

7. UNIX for Dummies Questions & Answers

etc/passwd

Can anyone explain the second and third fields in /etc/passwd. Thanks. (2 Replies)
Discussion started by: nguda
2 Replies

8. UNIX for Dummies Questions & Answers

passwd

hello, I don't why I can't change the password, when ever I try to run passwd I get the problem??!!! unixws1:ldb> passwd passwd: Changing password for ldb Permission denied regards, me (2 Replies)
Discussion started by: geoquest
2 Replies

9. UNIX for Advanced & Expert Users

passwd

I have to change more then 200 User at once the password (security-dday). The programm passwd will answers (new password + again) How can i do this in a script? thanks for answers (5 Replies)
Discussion started by: Erwin Stocker
5 Replies

10. UNIX for Advanced & Expert Users

passwd

Hi, Besides of the command "passwd" on Solaris and HP-UX and IRIX that allow users to change their passwords on the system. Is there anyother way a user can change his/her own password. Do any of these systems have a GUI interface to allow the user doing so? Thanks (3 Replies)
Discussion started by: vtran4270
3 Replies
Login or Register to Ask a Question