Like so: sed s/\\.[^.]*$// On Monday, December 31, 2012, Scot Hacker wrote:
> > On Dec 30, 2012, at 9:54 PM, William Ehrich <[email protected]<javascript:;>> > wrote: > > > I'm trying to write a shell script (in a tcsh) which uses a filename > argument without its extension: > > > > filename=$1:r > > echo filename > > > > doesn't work. What is the right way to do it? > > Not sure about tcsh, but this will do it in bash: > > $ filename='foo.txt' > $ echo $filename | sed s/\\..*$// > foo > > If you need foo.bar.txt to to return foo.bar you'll need something a bit > stronger... > > ./s > > _______________________________________________ > MacOSX-talk mailing list > [email protected] <javascript:;> > http://www.omnigroup.com/mailman/listinfo/macosx-talk > -- Jared Earle :: There is no SPORK [email protected] :: http://jearle.eu Hosting :: http://cat5.org Blog :: http://blog.23x.net
_______________________________________________ MacOSX-talk mailing list [email protected] http://www.omnigroup.com/mailman/listinfo/macosx-talk
