On Sat, May 18, 2013 at 7:31 PM, James Pifer <j...@obrien-pifer.com> wrote:
>
> 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
>
> So I need to take the data after the FIRST OU and stick in front of DATA
> with an _ in between. The rest of the line then remains the same.
>
> Hope it makes sense. Appreciate the help!

This should work as long as the first OU always follows CN=DATA.:

sed -e's/DATA.OU=\(\w*\)/\1_DATA.OU=\1/'

--
  Les Mikesell
     lesmikes...@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Reply via email to