Re: [SLUG] fun with sed

2007-09-26 Thread Ken Foskey
On Wed, 2007-09-26 at 10:35 +1000, Jeff Waugh wrote: My muscle memory now prefers # as a sed delimiter instead of /... which can be problematic with some implementations, but not in the imporant ones (GNU sed, vim, etc). ;-) # tends to be safe in more contexts than most of the other

Re: [SLUG] fun with sed

2007-09-26 Thread Deeþan Chakravarthy
david wrote: I want to insert / into a substitution. Why am i getting an unknown option even though exactly the same construction works if i use it from a script file? [EMAIL PROTECTED]:~/test $ cat foo foo is barred # test file [EMAIL

Re: [SLUG] fun with sed

2007-09-26 Thread Matthew Hannigan
On Wed, Sep 26, 2007 at 05:11:32PM +0800, Deeþan Chakravarthy wrote: $sed -e s|foo|/bar|g foo The above command works fine. You can use any character as delimiter. I chose to use | . My favourite alternative to / is comma, it doesn't need you to hit shift and you are not often searching for

Re: [SLUG] fun with sed

2007-09-26 Thread david
On Wed, 2007-09-26 at 20:28 +1000, Matthew Hannigan wrote: On Wed, Sep 26, 2007 at 05:11:32PM +0800, Deeþan Chakravarthy wrote: $sed -e s|foo|/bar|g foo The above command works fine. You can use any character as delimiter. I chose to use | . Lesson #83 man doesn't mention delimiter

Re: [SLUG] fun with sed

2007-09-26 Thread Michael Lake
david wrote: man doesn't mention delimiter options, but info does. looks like I need to get familiar with info man is easy to use. info is abominable. In fact I have done 'info info' more times than 'info any_thing_else'. Mike -- Michael Lake Computational Research Support Unit Science

Re: [SLUG] fun with sed

2007-09-26 Thread david
On Thu, 2007-09-27 at 10:00 +1000, Michael Lake wrote: david wrote: man doesn't mention delimiter options, but info does. looks like I need to get familiar with info man is easy to use. info is abominable. In fact I have done 'info info' more times than 'info any_thing_else'.

Re: [SLUG] fun with sed

2007-09-26 Thread Erik de Castro Lopo
david wrote: couldn't agree more but if the info isn't in man, then I have to man-age info :( The 'pinfo' program (avaliable on at least Debian and Ubuntu) is one of the better info readers that I've seen. Erik -- - Erik de

Re: [SLUG] fun with sed

2007-09-26 Thread david
On Thu, 2007-09-27 at 11:50 +1000, Erik de Castro Lopo wrote: david wrote: couldn't agree more but if the info isn't in man, then I have to man-age info :( The 'pinfo' program (avaliable on at least Debian and Ubuntu) is one of the better info readers that I've seen. excellent!

Re: [SLUG] fun with sed

2007-09-26 Thread jam
On Thursday 27 September 2007 10:00:03 [EMAIL PROTECTED] wrote: man doesn't mention delimiter options, but info does. looks like I need to get familiar with info man is easy to use. info is abominable. In fact I have done 'info info' more times than 'info any_thing_else'. Yet another

Re: [SLUG] fun with sed

2007-09-26 Thread Jeremy Portzer
[EMAIL PROTECTED] wrote: On Thursday 27 September 2007 10:00:03 [EMAIL PROTECTED] wrote: man doesn't mention delimiter options, but info does. looks like I need to get familiar with info man is easy to use. info is abominable. In fact I have done 'info info' more times than 'info

Re: [SLUG] fun with sed

2007-09-25 Thread david
On Mon, 2007-09-24 at 23:26 +1000, Zhasper wrote: You don't have to use / as a delimiter. Use something else. [EMAIL PROTECTED]:~$ cat foo foo is barred [EMAIL PROTECTED]:~$ sed [EMAIL PROTECTED]@/[EMAIL PROTECTED] foo /bar is barred that's excellent! I had no idea you could do that.

Re: [SLUG] fun with sed

2007-09-25 Thread Jeff Waugh
quote who=david that's excellent! I had no idea you could do that. Ask SLUG and you get all these great answers. [EMAIL PROTECTED]:~/test $ sed -e sxfoox/barxg foo /bar is barred That sort of thing will save a lot of messing around with escaping characters. My muscle memory now prefers

[SLUG] fun with sed

2007-09-24 Thread david
I want to insert / into a substitution. Why am i getting an unknown option even though exactly the same construction works if i use it from a script file? [EMAIL PROTECTED]:~/test $ cat foo foo is barred # test file [EMAIL PROTECTED]:~/test $ sed

Re: [SLUG] fun with sed

2007-09-24 Thread Ken Foskey
On Mon, 2007-09-24 at 22:49 +1000, david wrote: I've noticed the same problem applies to using in the replacement on the cli. It seems that the replacement part doesn't recognise a backslash. Have I missed something? first slash is absorbed by shell and therefore sed does not get it. use

Re: [SLUG] fun with sed

2007-09-24 Thread Martin Visser
I always find it much safer to use an explicit in-line script idiom such as :- sed -e 'the-script-i-want-sed-to-run' foo The ''s make sure that the shell doesn't get first byte of the cherry On 9/24/07, david [EMAIL PROTECTED] wrote: I want to insert / into a substitution. Why am i getting

Re: [SLUG] fun with sed

2007-09-24 Thread david
On Mon, 2007-09-24 at 23:00 +1000, Martin Visser wrote: I always find it much safer to use an explicit in-line script idiom such as :- sed -e 'the-script-i-want-sed-to-run' foo The ''s make sure that the shell doesn't get first byte of the cherry I kinda tried that, but man sed doesn't

Re: [SLUG] fun with sed

2007-09-24 Thread Zhasper
You don't have to use / as a delimiter. Use something else. [EMAIL PROTECTED]:~$ cat foo foo is barred [EMAIL PROTECTED]:~$ sed [EMAIL PROTECTED]@/[EMAIL PROTECTED] foo /bar is barred On 24/09/2007, david [EMAIL PROTECTED] wrote: I want to insert / into a substitution. Why am i getting an