[note: trn thinks 'Poster' is different from 'poster' in a followup-to:
line; in any case there doesn't seem to be an MX record for 'ebo.ci.net'
anywhere, I did try mail first...]
Quote:>I want to turn input that looks like
> [remove duplicate spaces]
>Can sed do this? (My copy doesn't seem to use '+' to mean one or
>more.) (And if it varies, my input is filled with spaces, not
>tabs.)
sed uses ed regular expressions (nearly) and '+' does not mean
'one-or-more' in ed. The following should work, though:
sed -e 's/ */ /g'
or, using a more general sed construct that's not realy needed in this
case, but possibly worth remembering:
sed -e 's/ \{1,\}/ /g' (meaning 1 or more, \{1,10\} means 1 to 10, etc)
(the g should be omitted if only the first occurrence of multiple spaces
is to be replaced)
Quote:>Other questions:
>1. Would it be wiser to ask this in c.u.shell?
probably, but there's not much in it.
Quote:>2. I'm sure there are 40 ways other than sed to do this; if you
> send me other suggestions, I'll summarize.
sed is probably the easiest, an alternative in sh (very specific
to this requirement) might be:
while read a rest
do
echo "$a $rest"
done
There are certainly other ways (awk for example), but it's largely a
matter of personal taste unless specific constraints apply.
-Malcolm