From: problems on
I often need to do:
search the current dir-tree,
for all files of *.Mod,
containing <a text string>

These *.Mod files are 'text' except for containing some
non-ascii strings and all lines are terminated by Char(13)
instead of Char(10).

Normally mc can find strings in a dir-tree, of proper linux
text-files, but I think it uses grep, which has a problem
when 'lines are not' terminated with Char(10) ?
I.e. are *NOT* lines ?

Eg. I can read them with:
strings <fileName> | more

Thanks for any feedback,

== Chris Glur.


From: whuddafugger on
In alt.os.linux.slackware problems(a)gmail wrote:
> I often need to do:
> search the current dir-tree,
> for all files of *.Mod,
> containing <a text string>

> These *.Mod files are 'text' except for containing some
> non-ascii strings and all lines are terminated by Char(13)
> instead of Char(10).


Have you tried:

grep "string" `find ./ -name "*.Mod"`



-- anthony
--
http://www.whuddafug.com

From: Grant on
On Sun, 06 Apr 2008 18:19:48 -0500, problems(a)gmail wrote:

>I often need to do:
> search the current dir-tree,
> for all files of *.Mod,
> containing <a text string>
>
>These *.Mod files are 'text' except for containing some
>non-ascii strings and all lines are terminated by Char(13)
>instead of Char(10).
>
>Normally mc can find strings in a dir-tree, of proper linux
>text-files, but I think it uses grep, which has a problem
>when 'lines are not' terminated with Char(10) ?
>I.e. are *NOT* lines ?
>
>Eg. I can read them with:
> strings <fileName> | more

So prefix with a 'tr ...' to change the CR to an LF in each file before
feeding to grep?

Grant.
--
http://bugsplatter.mine.nu/
From: ray on
On Sun, 06 Apr 2008 18:19:48 -0500, problems wrote:

> I often need to do:
> search the current dir-tree,
> for all files of *.Mod,
> containing <a text string>
>
> These *.Mod files are 'text' except for containing some non-ascii
> strings and all lines are terminated by Char(13) instead of Char(10).
>
> Normally mc can find strings in a dir-tree, of proper linux text-files,
> but I think it uses grep, which has a problem when 'lines are not'
> terminated with Char(10) ? I.e. are *NOT* lines ?
>
> Eg. I can read them with:
> strings <fileName> | more
>
> Thanks for any feedback,
>
> == Chris Glur.

find . -name "*.Mod" | grep -H "a text string"
From: Henrik Carlqvist on
problems(a)gmail wrote:
> I often need to do:
> search the current dir-tree,
> for all files of *.Mod,
> containing <a text string>

find . -name "*.Mod" -exec grep -l "a text string" {} \;

This will work even if you have so many files that giving all files as an
argument to a single call to grep would give a too long command line.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc3(at)poolhem.se Examples of addresses which go to spammers:
root(a)localhost postmaster(a)localhost