Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
sed/regexp
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Hanner, Michael [SKY:P062:EXCH]  
View profile  
 More options Jun 30 2000, 3:00 am
Newsgroups: gnu.utils.help
From: "Hanner, Michael [SKY:P062:EXCH]" <mhan...@americasm01.nt.com>
Date: 2000/06/30
Subject: sed/regexp

Hi,

This is what I want to to:

a:\b.jar:a:\c.jar --->   a:\b.jar a:\c.jar

My question: how do I re-insert a grouping back into my string?

d:\>> echo "a:/b.jar:a:/c.jar" | sed -e"s/:\([A-Za-z]\)/ $1/g"
a:/b.jar :/c.jar

I am unable to re-insert my grouping back into the string.
I've tried \$1, $$1, ....

Thanks

Michael.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Chicares  
View profile  
 More options Jun 30 2000, 3:00 am
Newsgroups: gnu.utils.help
From: Greg Chicares <chica...@mindspring.com>
Date: 2000/06/30
Subject: Re: sed/regexp

"Hanner, Michael [SKY:P062:EXCH]" wrote:

> This is what I want to to:

> a:\b.jar:a:\c.jar --->   a:\b.jar a:\c.jar

> My question: how do I re-insert a grouping back into my string?

> d:\>> echo "a:/b.jar:a:/c.jar" | sed -e"s/:\([A-Za-z]\)/ $1/g"
> a:/b.jar :/c.jar

> I am unable to re-insert my grouping back into the string.
> I've tried \$1, $$1, ....

Try \1 (backslash one).

C:>echo a:/b.jar:a:/c.jar | sed -e"s/:\([A-Za-z]\)/ \1/g"
a:/b.jar a:/c.jar

Same command works with backslashes in input:

C:>echo a:\b.jar:a:\c.jar | sed -e"s/:\([A-Za-z]\)/ \1/g"
a:\b.jar a:\c.jar

C:\JUNK>sed --version
GNU sed version 3.02

Copyright (C) 1998 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.
[some windows port I picked up somewhere]

Other versions of sed might behave differently.

My sed bookmarks in case they're of use to you:

http://www.dreamwvr.com/sed-info/sed-faq.html

http://www.ptug.org/sed/sedfaq.html

http://seders.icheme.org/

http://www.dbnet.ece.ntua.gr/~george/sed/

http://www.bluesky.com.au:457/OSUserG/BOOKCHAPTER-14.html

http://www.gnu.org/manual/sed-3.02/html_mono/sed.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ken Pizzini  
View profile  
 More options Jul 1 2000, 3:00 am
Newsgroups: gnu.utils.help
From: k...@halcyon.com (Ken Pizzini)
Date: 2000/07/01
Subject: Re: sed/regexp
On Fri, 30 Jun 2000 11:10:43 -0400,
Hanner, Michael [SKY:P062:EXCH] <mhan...@americasm01.nt.com> wrote:

>This is what I want to to:

>a:\b.jar:a:\c.jar --->   a:\b.jar a:\c.jar

>My question: how do I re-insert a grouping back into my string?

>d:\>> echo "a:/b.jar:a:/c.jar" | sed -e"s/:\([A-Za-z]\)/ $1/g"

The "$1"-type notation is from perl; the sed way is "\1":
       echo "a:/b.jar:a:/c.jar" | sed -e"s/:\([A-Za-z]\)/ \1/g"

                --Ken Pizzini


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »