A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

windows batch file find command cmd line string



 
 
Thread Tools Display Modes
  #1  
Old November 10th 18, 01:17 AM posted to microsoft.public.windowsxp.general
Logan MacEwens
external usenet poster
 
Posts: 3
Default 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.
Ads
  #2  
Old November 10th 18, 11:06 AM posted to microsoft.public.windowsxp.general
R.Wieser
external usenet poster
 
Posts: 1,302
Default 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.


  #3  
Old November 10th 18, 02:48 PM posted to microsoft.public.windowsxp.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default 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

  #4  
Old November 10th 18, 04:55 PM posted to microsoft.public.windowsxp.general
Shadow
external usenet poster
 
Posts: 1,638
Default 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
  #5  
Old November 10th 18, 06:19 PM posted to microsoft.public.windowsxp.general
R.Wieser
external usenet poster
 
Posts: 1,302
Default 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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 11:24 PM.


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