Re: [CentOS] OT: Script Help

2013-06-03 Thread SilverTip257
On Thu, May 30, 2013 at 1:01 PM, Les Mikesell wrote: > On Thu, May 30, 2013 at 11:43 AM, Larry Martell > wrote: > > >>> Because a cat is a terrible thing to waste. > >>> > >> > >> It goes back to the days of expensive computing resources when every > >> process mattered (the days of wood

Re: [CentOS] OT: Script Help

2013-05-30 Thread m . roth
Larry Martell wrote: > On Thu, May 30, 2013 at 9:42 AM, wrote: >> Larry Martell wrote: >>> On Thu, May 30, 2013 at 8:37 AM, wrote: Tilman Schmidt wrote: > Am 18.05.2013 21:23, schrieb Larry Martell: >> cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' > >

Re: [CentOS] OT: Script Help

2013-05-30 Thread Les Mikesell
On Thu, May 30, 2013 at 11:43 AM, Larry Martell wrote: >>> Because a cat is a terrible thing to waste. >>> >> >> It goes back to the days of expensive computing resources when every >> process mattered (the days of wooden computers and iron >> programmers...). > > Exactly - it mattered on

Re: [CentOS] OT: Script Help

2013-05-30 Thread Larry Martell
On Thu, May 30, 2013 at 10:30 AM, Les Mikesell wrote: > On Thu, May 30, 2013 at 10:52 AM, Larry Martell > wrote: >> >>> cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' >> >> Because a cat is a terrible thing to waste. >> >>> >>> So why cat | sed? >> >> I reall

Re: [CentOS] OT: Script Help

2013-05-30 Thread Les Mikesell
On Thu, May 30, 2013 at 10:52 AM, Larry Martell wrote: > >> cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' > > Because a cat is a terrible thing to waste. > >> >> So why cat | sed? > > I really don't see why that is a big deal. It goes back to the days of expe

Re: [CentOS] OT: Script Help

2013-05-30 Thread Larry Martell
On Thu, May 30, 2013 at 9:42 AM, wrote: > Larry Martell wrote: >> On Thu, May 30, 2013 at 8:37 AM, wrote: >>> Tilman Schmidt wrote: Am 18.05.2013 21:23, schrieb Larry Martell: > cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' http://en.wikipedia.org/wiki/C

Re: [CentOS] OT: Script Help

2013-05-30 Thread m . roth
Larry Martell wrote: > On Thu, May 30, 2013 at 8:37 AM, wrote: >> Tilman Schmidt wrote: >>> Am 18.05.2013 21:23, schrieb Larry Martell: cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' >>> >>> http://en.wikipedia.org/wiki/Cat_%28Unix%29#Useless_use_of_cat >>> >>> Because a

Re: [CentOS] OT: Script Help

2013-05-30 Thread Larry Martell
On Thu, May 30, 2013 at 8:37 AM, wrote: > Tilman Schmidt wrote: >> Am 18.05.2013 21:23, schrieb Larry Martell: >>> cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' >> >> http://en.wikipedia.org/wiki/Cat_%28Unix%29#Useless_use_of_cat >> >> Because a cat is a terrible thing to wa

Re: [CentOS] OT: Script Help

2013-05-30 Thread m . roth
Tilman Schmidt wrote: > Am 18.05.2013 21:23, schrieb Larry Martell: >> cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' > > http://en.wikipedia.org/wiki/Cat_%28Unix%29#Useless_use_of_cat > > Because a cat is a terrible thing to waste. > Without even reading the wikipedia piece, I

Re: [CentOS] OT: Script Help

2013-05-30 Thread Tilman Schmidt
Am 18.05.2013 21:23, schrieb Larry Martell: > cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' http://en.wikipedia.org/wiki/Cat_%28Unix%29#Useless_use_of_cat Because a cat is a terrible thing to waste. SCNR T. signature.asc Description: OpenPGP digital signature ___

Re: [CentOS] OT: Script Help

2013-05-21 Thread Peter Eckel
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

Re: [CentOS] OT: Script Help

2013-05-21 Thread Peter Eckel
Hi James, perl -pne 's/^(CN=)(DATA\.OU=)((.*?)\.O=CO)$/$1$4_$2$3/' /file/name or, if you prefer in-place editing, perl -i.bak -pne 's/(CN=)(DATA\.OU=)((.*?)\.O=CO)/$1$4_$2$3/' /file/name which replaces the file with the modified version and keeps a .bak file around for security. Exampl

Re: [CentOS] OT: Script Help

2013-05-21 Thread Les Mikesell
On Sat, May 18, 2013 at 7:31 PM, James Pifer 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

Re: [CentOS] OT: Script Help

2013-05-21 Thread John Doe
From: John Doe > From: James Pifer >> I have a long file that has lines like this: >> some text >> some text2 >> CN=DATA.OU=XYZ.O=CO >> some text3 >> some text4 >> >> I need to change the middle line but leave the rest of the file as is >> like this: >> some text >> some text2 >> CN

Re: [CentOS] OT: Script Help

2013-05-21 Thread John Doe
From: James Pifer > I have a long file that has lines like this: > some text > some text2 > CN=DATA.OU=XYZ.O=CO > some text3 > some text4 > > I need to change the middle line but leave the rest of the file as is > like this: > some text > some text2 > CN=XYZ_DATA.OU=XYZ.O=CO > some text3 > some

Re: [CentOS] OT: Script Help

2013-05-19 Thread James Pifer
On 5/19/2013 9:03 AM, Larry Martell wrote: > On Sat, May 18, 2013 at 6:31 PM, James Pifer wrote: >> On 5/18/2013 3:23 PM, Larry Martell wrote: >>> On Sat, May 18, 2013 at 1:15 PM, James Pifer wrote: Sorry for the off topic, but don't a better resource. I'm not great at scripting, but ne

Re: [CentOS] OT: Script Help

2013-05-19 Thread Larry Martell
On Sat, May 18, 2013 at 6:31 PM, James Pifer wrote: > On 5/18/2013 3:23 PM, Larry Martell wrote: >> On Sat, May 18, 2013 at 1:15 PM, James Pifer wrote: >>> Sorry for the off topic, but don't a better resource. I'm not great at >>> scripting, but need a quick script to modify a file. >>> >>> I hav

Re: [CentOS] OT: Script Help

2013-05-18 Thread Leon Fauster
Am 19.05.2013 um 02:31 schrieb James Pifer : > On 5/18/2013 3:23 PM, Larry Martell wrote: >> On Sat, May 18, 2013 at 1:15 PM, James Pifer wrote: >> >> cat file | sed -e's/CN=DATA.OU=\(.*\)\.O=CO/CN=\1_DATA.OU=\1.O=CO/' > > Larry, > > Thanks for the answer. Still having trouble making it work. B

Re: [CentOS] OT: Script Help

2013-05-18 Thread zGreenfelder
> > Thanks for the answer. Still having trouble making it work. Been looking > at sed for the last two hours. Let me give a specific example of a few > lines I would want to change: > > 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

Re: [CentOS] OT: Script Help

2013-05-18 Thread James Pifer
On 5/18/2013 3:23 PM, Larry Martell wrote: > On Sat, May 18, 2013 at 1:15 PM, James Pifer wrote: >> Sorry for the off topic, but don't a better resource. I'm not great at >> scripting, but need a quick script to modify a file. >> >> I have a long file that has lines like this: >> >> some text >> s

Re: [CentOS] OT: Script Help

2013-05-18 Thread Larry Martell
On Sat, May 18, 2013 at 1:15 PM, James Pifer wrote: > Sorry for the off topic, but don't a better resource. I'm not great at > scripting, but need a quick script to modify a file. > > I have a long file that has lines like this: > > some text > some text2 > CN=DATA.OU=XYZ.O=CO > some text3 > some

[CentOS] OT: Script Help

2013-05-18 Thread James Pifer
Sorry for the off topic, but don't a better resource. I'm not great at scripting, but need a quick script to modify a file. I have a long file that has lines like this: some text some text2 CN=DATA.OU=XYZ.O=CO some text3 some text4 And this repeats, but XYZ changes. "DATA" is always called data