[U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT(PATH, '/' )

2006-07-14 Thread Stevenson, Charles
A Quick Friday afternoon question.
I'm writing a script and I have a fully qualified path in $path.
I want the final filename in that path.
   fname=`some_command $path`

I *know* there is some command for this,  but I cant find it.

So if path is /twas/brillig/and/the/slithy/toves, then I want toves
in standard out.

TIA,
cds
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT(PATH, '/' )

2006-07-14 Thread Timothy Snyder
[EMAIL PROTECTED] wrote on 07/14/2006 04:06:46 PM:

 So if path is /twas/brillig/and/the/slithy/toves, then I want toves
 in standard out.

Try something like this:
   filename=`basename $path`


Tim Snyder
Consulting I/T Specialist
U2 Consulting
North American Lab Services
IBM Software Group
717-545-6403
[EMAIL PROTECTED]
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT( PATH , '/' )

2006-07-14 Thread Baakkonen, Rodney A (Rod) 46K
cut -d/ -f7

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stevenson,
Charles
Sent: Friday, July 14, 2006 3:07 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT(PATH,
'/' )


A Quick Friday afternoon question.
I'm writing a script and I have a fully qualified path in $path.
I want the final filename in that path.
   fname=`some_command $path`

I *know* there is some command for this,  but I cant find it.

So if path is /twas/brillig/and/the/slithy/toves, then I want toves
in standard out.

TIA,
cds
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT(PATH, '/' )

2006-07-14 Thread John Krukoff
basename is probably what you want.

On Fri, 2006-07-14 at 16:06 -0400, Stevenson, Charles wrote:
 A Quick Friday afternoon question.
 I'm writing a script and I have a fully qualified path in $path.
 I want the final filename in that path.
fname=`some_command $path`
 
 I *know* there is some command for this,  but I cant find it.
 
 So if path is /twas/brillig/and/the/slithy/toves, then I want toves
 in standard out.
 
 TIA,
 cds
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
 
-- 
John Krukoff [EMAIL PROTECTED]
Land Title Guarantee Company
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT(PATH, '/' )

2006-07-14 Thread Charlie Rubeor
I believe that basename and dirname are what you are looking for.

For example, basename /tmp/abc/def would return def.

--
Charlie Rubeor
Senior Database Administrator
Wiremold/Legrand
60 Woodlawn Street
West Hartford, CT  06110
Tel: 800-233-6251 x3498
Fax: 860-523-3690
Email: [EMAIL PROTECTED]
--




Stevenson, Charles [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
07/14/2006 04:06 PM
Please respond to
u2-users@listserver.u2ug.org


To
u2-users@listserver.u2ug.org
cc

Subject
[U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT(PATH, '/' )






A Quick Friday afternoon question.
I'm writing a script and I have a fully qualified path in $path.
I want the final filename in that path.
   fname=`some_command $path`

I *know* there is some command for this,  but I cant find it.

So if path is /twas/brillig/and/the/slithy/toves, then I want toves
in standard out.

TIA,
cds
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT(PATH, '/' )

2006-07-14 Thread Stevenson, Charles
basename it is.
thanks!
cds 

  So if path is /twas/brillig/and/the/slithy/toves, 
  then I want toves in standard out.
 
 Try something like this:
filename=`basename $path`
 
 
 Tim Snyder
 Consulting I/T Specialist
 U2 Consulting
 North American Lab Services
 IBM Software Group
 717-545-6403
 [EMAIL PROTECTED]
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT( PATH , '/' )

2006-07-14 Thread Timothy Snyder
[EMAIL PROTECTED] wrote on 07/14/2006 04:25:51 PM:

 cut -d/ -f7

That works for the example provided, but what if the next string
encountered is /did/gyre/and/gimble/in/the/wabe?

Tim Snyder
Consulting I/T Specialist
U2 Consulting
North American Lab Services
IBM Software Group
717-545-6403
[EMAIL PROTECTED]
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] unix equivalent of FNAME = FIELD( PATH, '/', DCOUNT( PATH , '/' )

2006-07-14 Thread Stevenson, Charles
Actually,  I was thinking of cut,  but I don't see an option to get
the last piece.  The depth is unknown.
But I think there is another command that inverts a file, byte-by-byte,
let's call  bbbi (byte by byte inversion) cuz I don't know it either:

   bbbi $logname | cut -d/ -f1 | bbbi

Thanks to all of you for the help.   basename  dirname were what I
was trying to rememnber.
Now I can go home for the weekend.

Chuck Stevenson
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/