Hi.
The seds I have used do not do "in-place" processing by default. If they allow it, it's usually with the "-i" option.
If your
sed allows "-r", here's one way:
Code:
#!/bin/bash -
# @(#) s1 Demonstrate sed extended regular expression match, substitution.
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1) sed
FILE=${1-data1}
echo
echo " Input file $FILE:"
cat $FILE
echo
echo " As processed by sed:"
sed -r -e 's/([0-9]+)-([0-9]+)[ ]*/{\1..\2} /g' $FILE
exit 0
Producing:
Code:
% ./s1
(Versions displayed with local utility "version")
Linux 2.6.11-x1
GNU bash 2.05b.0
GNU sed version 4.1.2
Input file data1:
12-13 15-18 23-28 36-38 42-43 53-56 70-72 76 80-86 93-110 119-128
As processed by sed:
{12..13} {15..18} {23..28} {36..38} {42..43} {53..56} {70..72} 76 {80..86} {93..110} {119..128}
See
man sed for details ... cheers, drl