<br><br><div><span class="gmail_quote">On 2/21/08, <b class="gmail_sendername">David Restall - System Administrator</b> <<a href="mailto:dave@restall.net">dave@restall.net</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
Hi,<br><br> A bit of snipping is probably needed here :-)<br><br><br> >Owen Townend wrote:<br> >> On 2/20/08, David Restall - System Administrator <<a href="mailto:dave@restall.net">dave@restall.net</a>> wrote:<br>
 >>> Hi,<br> >>><br> >>>> On 2/20/08, Germain Morbe <<a href="mailto:germain.morbe@web.de">germain.morbe@web.de</a>> wrote:<br> >>>>> Hi all,<br> >>>>><br>
 >>>>> im looking for a solution to strip the file extension<br> >>>>> within a bash script.<br> >>>>><br> >>>>> thanks<br><br><br>Snip<br><br><br> >>>> Hey,<br>
 >>>>   Look into `sed`. Something like this should do it<br> >>>>   `sed -e 's/.*$//'`<br> >>>><br> >>>>   That's from the top of my head though, check it first!<br>
 >>> man basename may be useful :-)<br> >>><br> >>> and the Owen's sed command isn't quite right, use 's/\..*$//'.<br> >>><br> >>> The cut command could also be used using a delimter of . and so could<br>
 >>> awk.  TMTOWTDI :-)<br> >>><br> >>> TTFN<br> >><br> >><br> >> ahah, that's closer to what I was aiming for, but it still doesn't<br> >> account for files like '<br>
 >> file.name.ext' cutting them to 'file' though  it should only match the end<br> >> of the line... ?<br> >><br> >$ file=file.name.ext<br> >$ echo ${file%.*}<br> ><a href="http://file.name">file.name</a><br>
 ><br> >Is that what you want? :-)<br><br><br>Sed still works if you do :-<br><br> echo file.part2.part3..name.ext | sed 's/\.[^.]*$//'<br><br> but Heinrich has provided a far more elegant solution.  It's no good<br>
 if you're not using bash though :-)<br><br> If you regularly encounter this kind of problem, have a look for<br> regular expressions, once you have used them you will wonder how you got<br> by without them :-)<br><br>
 TTFN<br><br> D<br> ubuntu/users-2008-02-20.2.tx                   <a href="mailto:rebehn@ant.uni-bremen.de">rebehn@ant.uni-bremen.de</a><br><br>                                               <a href="mailto:germain.morbe@web.de">germain.morbe@web.de</a><br>
                                               <a href="mailto:owen.townend@gmail.com">owen.townend@gmail.com</a><br>                                               ubuntu-users<br> +----------------------------------------------------------------------------+<br>
 | Dave Restall, Computer Nerd, Cyclist, Radio Amateur G4FCU, Bodger          |<br> | Mob +44 (0) 7973 831245      Skype: dave.restall             Radio: G4FCU  |<br> | email : <a href="mailto:dave@restall.net">dave@restall.net</a>                     Web : Not Ready Yet :-(       |<br>
 +----------------------------------------------------------------------------+<br><br>| BOFH excuse #436:                                                          |<br> |                                                                            |<br>
 | Daemon escaped from pentagram                                              |<br> +----------------------------------------------------------------------------+<br><br></blockquote></div><br>Hey,<br>  Thanks, that regex makes sense (20-20 hindsight) turns out it was sed that I<br>
was confused about. Thanks for the clarity. <br><br>cheers,<br>Owen.<br><br>