I'm messing with a bash script that will remove spaces from filenames
(usually for mp3s I get from newsgroups). I had this:
echo $src | sed -e 's/[ ]+/_/g' -
("src" contains the filename with spaces in it) and thought that the "+"
would add a little bit of robustness, but the spaces didn't get replaced
when I used that regexp!
I tried "s/ /_/g" and "s/[ ]/_g" and those worked, and then found the
[[:space:]] character class, so my script works now.
Additionally, I think bash automatically strips out multiple whitespace:
I have a file called "lotsa spaces", and when I do
for f in * ; do echo $f ; done
it prints "lotsa spaces" for that file.
So I've fixed my problem -- but why doesn't sed understand "[ ]+" or
" +" ?
Thanks,
Dan
--
| 4699 BDCB B1A5 28B6 7F8A F8DF EB6A BC2A B0A1 99BF (GPG)
| Dan Drake <drake+tclug at lemongecko.org> | http://lemongecko.org/drake/
| public key: email <drake+gpg at lemongecko.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20011201/79ed77f3/attachment.pgp