Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* find, grep, basename usage?
@ 1999-01-07  5:00 ed wolfe
  1999-01-08  5:00 ` Rolf Hauck
  0 siblings, 1 reply; 3+ messages in thread
From: ed wolfe @ 1999-01-07  5:00 UTC (permalink / raw)


I'm trying to come up with a command that will search every *.mak file
in a directory heirarchy for a specific filename, and report just the
base filename (i.e., only what appears after the last / ), but can't
quite get what I need.  Part of the trouble seems to be that basename
won't take multiple filenames from a pipe.  I'm pretty sure I've seen
something like this somewhere, but have no idea where.

any suggestions appreciated ... ...



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: find, grep, basename usage?
  1999-01-07  5:00 find, grep, basename usage? ed wolfe
@ 1999-01-08  5:00 ` Rolf Hauck
  1999-01-08  5:00   ` ed wolfe
  0 siblings, 1 reply; 3+ messages in thread
From: Rolf Hauck @ 1999-01-08  5:00 UTC (permalink / raw)
  To: ed wolfe

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

what about (ksh example):

for file in $(find . -name '*.mak')
do 
  if grep -q YourFilename $file
  then
    basename $file
  fi
done

HTH Rolf

ed wolfe schrieb:
> 
> I'm trying to come up with a command that will search every *.mak file
> in a directory heirarchy for a specific filename, and report just the
> base filename (i.e., only what appears after the last / ), but can't
> quite get what I need.  Part of the trouble seems to be that basename
> won't take multiple filenames from a pipe.  I'm pretty sure I've seen
> something like this somewhere, but have no idea where.
> 
> any suggestions appreciated ... ...

[-- Attachment #2: Visitenkarte f�r Rolf Hauck --]
[-- Type: text/x-vcard, Size: 240 bytes --]

begin:          vcard
fn:             Rolf Hauck
n:              ;Rolf Hauck
org:            datenrevision GmbH
email;internet: Rolf.Hauck@datenrevision.de
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: find, grep, basename usage?
  1999-01-08  5:00 ` Rolf Hauck
@ 1999-01-08  5:00   ` ed wolfe
  0 siblings, 0 replies; 3+ messages in thread
From: ed wolfe @ 1999-01-08  5:00 UTC (permalink / raw)


thanks! another respondent suggested using xargs, which is what I was
trying to recall:

find . -name Makefile -exec grep -w RoiUi.o {} \; | xargs -n1 basename


Rolf Hauck wrote:
> 
> what about (ksh example):
> 
> for file in $(find . -name '*.mak')
> do
>   if grep -q YourFilename $file
>   then
>     basename $file
>   fi
> done
> 
> HTH Rolf
> 
> ed wolfe schrieb:
> >
> > I'm trying to come up with a command that will search every *.mak file
> > in a directory heirarchy for a specific filename, and report just the
> > base filename (i.e., only what appears after the last / ), but can't
> > quite get what I need.  Part of the trouble seems to be that basename
> > won't take multiple filenames from a pipe.  I'm pretty sure I've seen
> > something like this somewhere, but have no idea where.
> >
> > any suggestions appreciated ... ...
> 
>     ---------------------------------------------------------------
> 
>                             Name: vcard.vcf
>            Part 1.2         Type: text/x-vcard
>                         Encoding: 7bit
>                      Description: Visitenkarte f�r Rolf Hauck



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-01-08  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-01-07  5:00 find, grep, basename usage? ed wolfe
1999-01-08  5:00 ` Rolf Hauck
1999-01-08  5:00   ` ed wolfe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox