[CentOS] OT: Script Help

Peter Eckel lists at eckel-edv.de
Tue May 21 18:53:06 UTC 2013


Oops, I read that too late ... 

> Let's say my original lines are:
> CN=DATA.OU=XYZ.O=CO
> CN=DATA.OU=XYY.OU=MEM.O=CO
> CN=DATA.OU=XZZ.OU=OOP.O=CO
> 
> I want them to look like:
> CN=XYZ_DATA.OU=XYZ.O=CO
> CN=XYY_DATA.OU=XYY.OU=MEM.O=CO
> CN=XZZ_DATA.OU=XZZ.OU=OOP.O=CO

then the perl script would be 

  perl -pne 's/(CN=)(DATA\.OU=)((.*?)\.O.*)$/$1$4_$2$3/' /file/name

Best regards, 

  Peter.



More information about the CentOS mailing list