cut file extension

David Restall - System Administrator dave at restall.net
Wed Feb 20 12:44:43 UTC 2008


Hi,

> On 2/20/08, Germain Morbe <germain.morbe at web.de> wrote:
> >
> > Hi all,
> >
> > im looking for a solution to strip the file extension
> > within a bash script.
> >
> > thanks
> >
> > --
> > ubuntu-users mailing list
> > ubuntu-users at lists.ubuntu.com
> > Modify settings or unsubscribe at:
> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> >
> 
> Hey,
>   Look into `sed`. Something like this should do it
>   `sed -e 's/.*$//'`
> 
>   That's from the top of my head though, check it first!

man basename may be useful :-)

and the Owen's sed command isn't quite right, use 's/\..*$//'.

The cut command could also be used using a delimter of . and so could
awk.  TMTOWTDI :-)

TTFN


D
ubuntu/users-2008-02-20.tx                     germain.morbe at web.de
                                               owen.townend at gmail.com
                                               ubuntu-users
+----------------------------------------------------------------------------+
| Dave Restall, Computer Nerd, Cyclist, Radio Amateur G4FCU, Bodger          |
| Mob +44 (0) 7973 831245      Skype: dave.restall             Radio: G4FCU  |
| email : dave at restall.net                     Web : Not Ready Yet :-(       |
+----------------------------------------------------------------------------+
| The greatest dangers to liberty lurk in insidious encroachment by men      |
| of zeal, well-meaning but without understanding.                           |
|         -- Justice Louis D. Brandeis                                       |
+----------------------------------------------------------------------------+





More information about the ubuntu-users mailing list