PCbanter

PCbanter (http://www.pcbanter.net/index.php)
-   General XP issues or comments (http://www.pcbanter.net/forumdisplay.php?f=18)
-   -   windows batch file find command cmd line string (http://www.pcbanter.net/showthread.php?t=1106345)

Logan MacEwens November 10th 18 12:17 AM

windows batch file find command cmd line string
 
find . -type f -print0 | xargs -0 -I{} grep -l abc {} | xargs -I{} emacs --eval='(find-file "{}")' --eval='(search-forward "abc")'

Is there any way to run a find like that on Windows
in a batch file command of some sort to find
the string "abc" in text files only?

It has to run inside a batch file.

R.Wieser November 10th 18 10:06 AM

windows batch file find command cmd line string
 
Logan,

Is there any way to run a find like that on Windows


I'm missing a description of the problem you encountered.

What, in that command line, doesn't work for you ? What should it do and
what does it do instead.


Also, you could do worse than to explain what the non-windows parts (xargs)
of that command should be doing / what the whole command is supposed to be
doing.

Looking at your description (find a string in a set of textfiles) it looks
to be way over-engeneered. Which means that I most likely am missing
something (which might have to do with me not having a clue what those
"xargs" parts are supposed to be doing :-) ).

Trying to use XPs "find" won't work that well: It will output the name of
*every* file it works on, regardless of if it contains what you're looking
for or not.

Personally I use a (Borland 1989 - very old) DOS version of GREP, which can
output the filenames and every line it finds a string on, or only display
filenames (and has a slew of other possibly usefull arguments).

Regards,
Rudy Wieser

P.s.
If you can use a command on the commandline you can use it in a batchfile.
Its as simple as that.



Paul[_32_] November 10th 18 01:48 PM

windows batch file find command cmd line string
 
R.Wieser wrote:
Logan,

Is there any way to run a find like that on Windows


I'm missing a description of the problem you encountered.

What, in that command line, doesn't work for you ? What should it do and
what does it do instead.


Also, you could do worse than to explain what the non-windows parts (xargs)
of that command should be doing / what the whole command is supposed to be
doing.

Looking at your description (find a string in a set of textfiles) it looks
to be way over-engeneered. Which means that I most likely am missing
something (which might have to do with me not having a clue what those
"xargs" parts are supposed to be doing :-) ).

Trying to use XPs "find" won't work that well: It will output the name of
*every* file it works on, regardless of if it contains what you're looking
for or not.

Personally I use a (Borland 1989 - very old) DOS version of GREP, which can
output the filenames and every line it finds a string on, or only display
filenames (and has a slew of other possibly usefull arguments).

Regards,
Rudy Wieser

P.s.
If you can use a command on the commandline you can use it in a batchfile.
Its as simple as that.


WinXP has:

findstr /?

Paul


Shadow November 10th 18 03:55 PM

windows batch file find command cmd line string
 
On Sat, 10 Nov 2018 00:17:00 +0000, Logan MacEwens
wrote:

find . -type f -print0 | xargs -0 -I{} grep -l abc {} | xargs -I{} emacs --eval='(find-file "{}")' --eval='(search-forward "abc")'

Is there any way to run a find like that on Windows
in a batch file command of some sort to find
the string "abc" in text files only?

It has to run inside a batch file.


You can pipe the text content into findstr

command for text content 2&1| findstr /i "yourstring"

Can't remember enough Unix to translate your shell command.
[]'s
--
Don't be evil - Google 2004
We have a new policy - Google 2012

R.Wieser November 10th 18 05:19 PM

windows batch file find command cmd line string
 
Paul,

WinXP has:

findstr /?


Thanks. A quick peek at it gives me the idea I should remember it. It
might even be better than my old grep.

Regards,
Rudy Wieser




All times are GMT +1. The time now is 03:23 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2006 PCbanter
Comments are property of their posters