|
From: problems on 6 Apr 2008 19:19 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 6 Apr 2008 19:37 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 6 Apr 2008 19:41 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 6 Apr 2008 20:22 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 7 Apr 2008 02:19 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
|
Pages: 1 Prev: What Gnome in Slack 12.0? Next: 2.6.24.4 problems with urandom |