Post #208,624
5/25/05 9:37:05 PM
|

s/a/per/
----------------------------------------- "In this world of sin and sorrow there is always something to be thankful for. As for me, I rejoice that I am not a Republican." -- H. L. Mencken
Support our troops, Impeach Bush. D. D. Richards
|
Post #208,625
5/25/05 9:42:08 PM
|

s/ a / per /; # Your substitution had a bug :-P
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
|
Post #208,626
5/25/05 9:49:53 PM
|

Don't even know the language the "s/" thingie is from
My only exposure to it is on these forums and I submit that with only that knowledge of usage, it was correct.
----------------------------------------- "In this world of sin and sorrow there is always something to be thankful for. As for me, I rejoice that I am not a Republican." -- H. L. Mencken
Support our troops, Impeach Bush. D. D. Richards
|
Post #208,629
5/25/05 10:09:29 PM
|

It appears in several, including Perl
Here is your bug. That substitution on that subject line would give How mperny do you need to consume a month?
After you see why, you'll see why my version fixed it.
Cheers, Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
|
Post #208,653
5/26/05 7:27:47 AM
|

Gotcha
Need the spaces or all the a's get replaced.
Makes sense
----------------------------------------- "In this world of sin and sorrow there is always something to be thankful for. As for me, I rejoice that I am not a Republican." -- H. L. Mencken
Support our troops, Impeach Bush. D. D. Richards
|
Post #208,664
5/26/05 9:56:05 AM
|

s/all the a's/the first a/
you can add a g at the end of the command to replace all the occurences:
s/oldtext/newtext/g will replace all occurences of 'oldtext' with 'newtext' in the set of text you feed it.
-- Steve
|
Post #208,673
5/26/05 10:24:32 AM
|

Started in sed
Unix ed, ex/vi, and then Perl stole it from there.
|
Post #208,630
5/25/05 11:18:57 PM
|

Err: s/\\ a\\ /\\ per\\ / # I WOT
-- [link|mailto:greg@gregfolkert.net|greg], [link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey [image|http://www.danasoft.com/vipersig.jpg||||]
|
Post #208,635
5/26/05 12:56:11 AM
|

Why escape the spaces?
Save Fintlewoodlewix
|
Post #208,655
5/26/05 7:38:42 AM
|

I use sed.
-- [link|mailto:greg@gregfolkert.net|greg], [link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey [image|http://www.danasoft.com/vipersig.jpg||||]
|
Post #208,721
5/26/05 3:08:24 PM
|

That's the shell's behaviour, not sed's
Try it:
echo How many do you need to consume a month? | sed 's/ a / per /'
Cheers, Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
|