24 Jan
2005
24 Jan
'05
21:36
Ryan, On Monday 24 January 2005 13:25, Ryan McCain wrote:
I have a file that has 100 or so lines in this format:
dn: cn=SERVERNAME1,ou=NWSERVERS,ou=SERVER03,ou=iServices,ou=MON,o=LA dn: cn=SERVERNAME2,ou=NWSERVERS,ou=SERVER03,ou=iServices,ou=MON,o=LA dn: cn=SERVERNAME3,ou=NWSERVERS,ou=SERVER03,ou=iServices,ou=MON,o=LA
How can I strip out everything execpt the servername? Using either shell scripting, sed or perl?
Which field is "the" server name? Assuming it's the "cn=" and that the log file name is "logFile", do this: sed -e 's/.*cn=[^,][^,]*,.*//' logFile Adjust it as necessary if you want a different field.
Thanks, Ryan
Randall Schulz