cut file extension
Owen Townend
owen.townend at gmail.com
Wed Feb 20 13:20:42 UTC 2008
On 2/20/08, David Restall - System Administrator <dave at restall.net> wrote:
>
> 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
ahah, that's closer to what I was aiming for, but it still doesn't
account for files like '
file.name.ext' cutting them to 'file' though it should only match the end
of the line... ?
cheers,
Owen.
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 |
>
> +----------------------------------------------------------------------------+
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080221/305f129a/attachment.html>
More information about the ubuntu-users
mailing list