cut file extension
Heinrich Rebehn
rebehn at ant.uni-bremen.de
Wed Feb 20 12:51:06 UTC 2008
Owen Townend 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.
>
>
If the file extension is known, then you can also use bash builtins like:
$ file=pic.jpg
$ echo ${file%.jpg}
pic
-Heinrich
More information about the ubuntu-users
mailing list