[Gllug] regular expression

Stig Brautaset stig at brautaset.org
Thu Aug 5 14:06:11 UTC 2004


On Thu, Aug 05, 2004 at 02:52:05PM +0100, Simon Jakesch wrote:
> Hi,
> 
> I am not too skilled when it comes to regular expressions and therefore 
> can't think of a way on how to turn this:
> ./Directory With Spaces/More Urgly Spaces/FileName.java
> 
> into this:
> ./Directory\ With\ Spaces/More\ Urgly\ Spaces/FileName.java

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'

Stig

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list