[ale] Looking for a one line script

Robert L. Harris Robert.L.Harris at rdlg.net
Mon Jun 13 19:52:49 EDT 2005




echo "/foo/bar/shi/tia.txt" | sed -e 's,[^/]*$,,g'


Thus spake James Sumners (james.sumners at gmail.com):

> I need to get the base path of a filename. For example, if I have
> "/path/to/some/random/file.ext" I need to trim off "file.ext" so that
> I am left with "/path/to/some/random/". However, the filename could
> contain spaces and other odd characters. Any suggestions?
> 
> -- 
> James Sumners
> http://james.roomfullofmirrors.com/
> 
> "All governments suffer a recurring problem: Power attracts
> pathological personalities. It is not that power corrupts but that it
> is magnetic to the corruptible. Such people have a tendency to become
> drunk on violence, a condition to which they are quickly addicted."
> 
> Missionaria Protectiva, Text QIV (decto)
> CH:D 59
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale

:wq!
---------------------------------------------------------------------------
Robert L. Harris                     | GPG Key ID: E344DA3B
                                         @ x-hkp://pgp.mit.edu
DISCLAIMER:
      These are MY OPINIONS             With Dreams To Be A King,
       ALONE.  I speak for              First One Should Be A Man
       no-one else.                       - Manowar

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature




More information about the Ale mailing list