× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Not a silly question. Have not used grep (or needed to) for this type of
search. Your answer is elegant, since that option is exactly what I wanted to
accomplish.

I still don't understand, however, why the sequence I used displayed file names
that did not contain the search string. But, that really doesn't matter in
this instance.

Thanks for the help.

John McKee

Quoting Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>:

Perhaps a silly question, but... why not simply do this:

grep -l string *.txt

That'll search all files that match the pattern *.txt without any need
to code a loop. The -l switch means to print the filename only and not
list the lines of the file that match.


John McKee wrote:
I know this has been discussed at some point. Not sure as to how it was
resolved.

I am needing to locate files in an IFS directory that contain a given string.

Using qp2term, I entered this:

cd to appropriate directory

for i in `ls *.txt`
do
cat $i |grep string && echo $i
done


Eight file names were displayed. I have searched one named file and those
around it, but cannot find the string that was (if I did it right) that was
located.

Two questions:

1) Since echo command is only performed when grep is successful, qhy is the
value presented not apparently a file that contains the string located by grep?

2) Any way that I can disable the huge quantity of job logs produced by the
above commands? Message logging is currently set to 4 0 *NOLIST and *NO

Thanks!


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.