cut file extension

Owen Townend owen.townend at gmail.com
Wed Feb 20 12:40:57 UTC 2008


On 2/20/08, Owen Townend <owen.townend at gmail.com> wrote:
>
>
>
> 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!
>
> cheers,
> Owen.
>

ehem, sorry,
  just realised that wipes the whole line...
  Try `sed -e 's/.mp3$//'` for a single extension.
  `sed -e 's/.mp3$/.wma/'` to change it.
  `sed -e 's/....$//'`  to cut a three letter extension and the '.'
  etc...

cheers,
Owen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080220/9a36c8ce/attachment.html>


More information about the ubuntu-users mailing list