home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!torn!nott!bnrgate!bcars664!leibniz!walt
- From: walt@bcarh1d7.bnr.ca (Walt Sullivan)
- Newsgroups: comp.unix.questions
- Subject: Re: Command to parse text...
- Message-ID: <WALT.92Dec14133826@bcarh1d7.bnr.ca>
- Date: 14 Dec 92 18:38:26 GMT
- References: <lux.723676699@sol.UVic.CA> <1992Dec6.230758.5330@news.columbia.edu>
- Sender: news@bcars664.bnr.ca
- Organization: Bell-Northern Research, Ottawa, Canada
- Lines: 34
- In-reply-to: kwak@cunixf.cc.columbia.edu's message of 6 Dec 92 23:07:58 GMT
-
- >>>>> On 6 Dec 92 23:07:58 GMT, kwak@cunixf.cc.columbia.edu (Nancy Kwak) said:
- Nancy> Nntp-Posting-Host: cunixf.cc.columbia.edu
-
- Nancy> In article <lux.723676699@sol.UVic.CA> lux@sol.UVic.CA (Michael O'Henly) writes:
- > I need a command that will take a line of input that looks like
- >this...
- >
- > /is/gd/.int_res/.text/.lib/.docs/filename
- >
- > ...and return the string "filename". In other words, it's got to
- >return all the text between the last "/" and the end of the input
- >line.
-
- Nancy> this should do it.
-
- Nancy> for $a = "/usr/abc/file" or just "file"
-
- Nancy> expr $a : '.*/\(.*\)' \| $a
-
- what's wrong with basename(1)?
-
- a="/is/gd/.int_res/.text/.lib/.docs/filename"
- echo "`basename $a`"
-
- produces
-
- filename"
-
-
- --
- Walt Sullivan
- INTERNET: walt@bnr.ca (work)
- UUCP: walt@orbit.ocunix.on.ca (home)
- FIDO: 1:163/109.4
-