[Gllug] regular expression

Bruce Richardson itsbruce at uklinux.net
Thu Aug 5 17:09:19 UTC 2004


On Thu, Aug 05, 2004 at 03:06:11PM +0100, Stig wrote:
> 
> I recon you get the same effect just by quoting the filename. However,
> if that's not what you want, something like this should do (caveat:
> won't work if any of the spaces are already escaped):
> 
> echo "./Directory With Spaces/More Urgly Spaces/FileName.java" | sed 's, ,\\ ,g'

You're quite right.  One thing though: I find it a good habit to get
into, with things Unixish, always to use single quotes unless double
quotes are required.  It wouldn't make any difference in this case but
it would be more consistent to use single quotes all the way through.

-- 
Bruce

I see a mouse.  Where?  There, on the stair.  And its clumsy wooden
footwear makes it easy to trap and kill.  -- Harry Hill
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: Digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20040805/3f93b9b9/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list