On Monday 24 January 2005 23:29, James Knott wrote:
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?
man cut
cat file | cut -d':' -f2 | cut -d',' -f1 | cut -d'=' -f2 Paul H -- ____________________________________________________________________ / An American's a person who isn't afraid to criticize the President \ \ but is always polite to traffic cops. / -------------------------------------------------------------------- \ ^__^ \ (@@)\_______ (__)\ )\/\ ||----w | || || -- Paul Hewlett (Linux #359543) Email:`echo az.oc.evitcaten@ttelweh | rev` Tel: +27 21 852 8812 Cel: +27 72 719 2725 Fax: +27 86 672 0563 --