[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sed: enhance s///NUMBER to handle ranges
From: |
Dan Jacobson |
Subject: |
sed: enhance s///NUMBER to handle ranges |
Date: |
31 May 2002 18:41:26 +0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
In sed we can do
s/ / /3
to double the third blank on the line, or
s/ / /g
to double all blanks on the line,
but there is no say,
s/ / /3-
to double all the blanks starting at the third, because in Info it says
`NUMBER'
Only replace the NUMBERth match of the REGEXP.
In perl
s/PATTERN/REPLACEMENT/egimosx
doesn't seem to do numbers.
$ echo 's/a/b/3'|/usr/bin/s2p
Unrecognized substitution command(3) at line 1
I.e. couldn't translate it to perl.
Anyways, it sure would be nice if sed could be enhanced to do ranges
instead of a single occurrence. Better make it deluxe with inclusive
and exclusive ranges, the works.
--
http://jidanni.org/ Taiwan(04)25854780
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- sed: enhance s///NUMBER to handle ranges,
Dan Jacobson <=