Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

could someone help me on the script to list data from a file?

Status
Not open for further replies.

dos2unix

Technical User
Oct 9, 2003
1
US
Hi,

I could someone help me on the script?
I need to write a script that can pull the data from a file that had the data that I wanted.

Below is sample file. I would like to list the users that had the DisabledFlag: 8 only. The data is separated by a blank line.

dn: uid=KCROOKS,dc=myoffice,dc=com
cn: oms user4
DisabledFlag: 8

dn: uid=cmw3111,dc=myoffice,dc=com
cn: Tom Warner
mail: tw@system.com
DisabledFlag: 0

dn: uid=KCROOKS,dc=myoffice,dc=com
cn: oms user4
DisabledFlag: 2

Thanks,
Ken
 
nawk -f dos2unix.awk myFile.txt

#----------------------- does2unix.awk
BEGIN {
FS=RS=""
}

$NF ~ "DisabledFlag: 8" { split($1, a, "[:=,]"); print a[3]}


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top