git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Help a sed noob
Date: Sat, 04 Aug 2007 01:40:23 +0200	[thread overview]
Message-ID: <46B3BCE7.3090509@lsrfire.ath.cx> (raw)
In-Reply-To: <fcaeb9bf0708031622w25ab6e9ev61372169cfc0bd98@mail.gmail.com>

Nguyen Thai Ngoc Duy schrieb:
> Hi,
> 
> There is a construct like this in git-parse-remote.sh which makes
> busybox ash unhappy:
> 
>                 sed -ne '/^URL: */{
>                         s///p
>                         q
>                 }' "$GIT_DIR/remotes/$1"
> 
> It complains about "no previous regexp" while gnu sed is ok. Can
> anyone explain to me what does "s///p" do? GNU Sed info page says
> nothing about empty regexp. If I replace it with "s/\(.*\)/\1/p" then
> I get "URL: " along with the remote path.
> 
> By the way, can we use another construct instead? It would be less
> work for me ;-)

You could manually add the previous regular expression, like this:

		sed -ne '/^URL: */{
			s/^URL: *//p
			q
		}' "$GIT_DIR/remotes/$1"

René

  parent reply	other threads:[~2007-08-03 23:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-03 23:22 Help a sed noob Nguyen Thai Ngoc Duy
2007-08-03 23:38 ` Junio C Hamano
2007-08-04  0:06   ` Nguyen Thai Ngoc Duy
2007-08-03 23:40 ` René Scharfe [this message]
2007-08-04 10:31 ` martin f krafft
2007-08-04 11:50   ` Jeff King
2007-08-04 12:18     ` martin f krafft
2007-08-04 12:26       ` Simon 'corecode' Schubert
2007-08-04 13:56         ` martin f krafft
2007-08-04 14:06           ` David Kastrup
2007-08-04 12:40       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46B3BCE7.3090509@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).