[THIN] Re: Very OT: FINDSTR command

  • From: "Parker, Dennis" <Dennis.Parker@xxxxxxxxxx>
  • To: "thin@xxxxxxxxxxxxx" <thin@xxxxxxxxxxxxx>
  • Date: Tue, 03 Dec 2002 10:34:26 -0600

Oh VERY good...I forgot that he had mentioned that the files with spaces were 
the ones that couldn't be opened.

for /f "delims==" %a in ('findstr /I /M /C:"nw2 4er" "*.*"') do findstr /I /M 
/C:"se1 7sd" "%a"

Worked like a charm....should work for Phil as well.

Dennis

-----Original Message-----
From: Centeno, Ruben 
Sent: Tuesday, December 03, 2002 8:24 AM
To: 'thin@xxxxxxxxxxxxx'
Subject: [THIN] Re: Very OT: FINDSTR command



By default an empty space, such as in a file name, is interpreted as a field
delimiter.  Adding "delims==" (including the quotes) after /f and before %%a
{for /f "delims==" %%a in ...} to your batch file should do the trick. 

HTH
Ruben

-----Original Message-----
From: Phil.Hillary@xxxxxxxxxxxxxxxxxx
[mailto:Phil.Hillary@xxxxxxxxxxxxxxxxxx] 
Sent: Tuesday, December 03, 2002 10:57 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Very OT: FINDSTR command



It worked for you?  Very strange, as I've tried it on both NT4 and Win2K and
still get the cannot open file error message.  

Thanks for your help

Phil

-----Original Message-----
From: Parker, Dennis [mailto:Dennis.Parker@xxxxxxxxxx]
Sent: 03 December 2002 15:04
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Very OT: FINDSTR command



for /f %a in ('findstr /I /M /C:"nw2 4er" "*.*"') do findstr /I /M /C:"se1
7sd" "%a"

or in a batch file (.cmd whatever)

for /f %%a in ('findstr /I /M /C:"nw2 4er" "*.*"') do findstr /I /M /C:"se1
7sd" "%%a"


Worked for me in testing on a Win2K computer.  I know that some versions of
commands work differently on NT.

Hope this helps.
Dennis

-----Original Message-----
From: Phil.Hillary@xxxxxxxxxxxxxxxxxx 
Sent: Tuesday, December 03, 2002 6:27 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Very OT: FINDSTR command



Tried all that but still no joy.  The first error I get is "in was
unexpected at this time" and it gets worse from there :-)

Thanks for all your help on it.  I'll try and think of another way to do it.

Phil

-----Original Message-----
From: Braebaum, Neil [mailto:neil.braebaum@xxxxxxxxxxxxxxxxxxxxxxxx]
Sent: 03 December 2002 12:22
To: 'thin@xxxxxxxxxxxxx'
Subject: [THIN] Re: Very OT: FINDSTR command



Sometimes you need to double up, on your double quotes... ;-)

But it could be your *.* may need quoting? <shrug>

What do you get with:-

for /f "%a" in ('findstr /I /M /C:"nw2 4er" "*.*"') do findstr /I /M /C:"se1
7sd" "%a"

?

Oh there is the other gotcha, with for - when you use it in a cmd file, you
will need to double up on the %s - so if this is in a batch file, use %%a.

Neil

> -----Original Message-----
> From: Phil.Hillary@xxxxxxxxxxxxxxxxxx 
> [mailto:Phil.Hillary@xxxxxxxxxxxxxxxxxx] 
> Sent: 03 December 2002 12:14
> To: thin@xxxxxxxxxxxxx
> Subject: [THIN] Re: Very OT: FINDSTR command
> 
> I tried that as well but with the same error.  From what I 
> can see, the problem seems to lie with the second findstr and 
> using %a for the filename. This is the output I get on screen 
> when I search through file1.txt, file2.txt and file 3.txt:
> 
>       C:\>findstr /I /M /C:"sel 7sd" c:\postcode\file
>       FINDSTR: Cannot open c:\postcode\file
> 
>       C:\>findstr /I /M /C:"sel 7sd" c:\postcode\file1.txt
> 
>       C:\>findstr /I /M /C:"sel 7sd" c:\postcode\file2.txt
> 
> Most annoying!
> 
> -----Original Message-----
> From: Braebaum, Neil [mailto:neil.braebaum@xxxxxxxxxxxxxxxxxxxxxxxx]
> Sent: 03 December 2002 11:45
> To: 'thin@xxxxxxxxxxxxx'
> Subject: [THIN] Re: Very OT: FINDSTR command
> 
> As a general thing - filenames with spaces in, will need 
> double quotes when used as variables.
> 
> > -----Original Message-----
> > From: Phil.Hillary@xxxxxxxxxxxxxxxxxx
> > [mailto:Phil.Hillary@xxxxxxxxxxxxxxxxxx] 
> > Sent: 03 December 2002 11:41
> > To: thin@xxxxxxxxxxxxx
> > Subject: [THIN] Very OT: FINDSTR command
> > 
> > Hi all
> > 
> > I know this is OT so understand if I get no replies to it,
> > but this list is such an excellent source of information and 
> > I don't know where else to try.
> > 
> > We've been tasked with searching through our file servers for
> > any files which contain 2 strings of information.  As there 
> > are thousands of files to search through, we're using the 
> > following for command:
> > 
> >     for /f %a in ('findstr /I /M /C:"nw2 4er" *.*') do
> > findstr /I /M /C:"se1 7sd" %a
> > 
> > The problem we're having is it doesn't seem to be working on
> > file names with spaces in it and says it cannot open the 
> > file.  Anyone have any ideas?

***********************************************************************
This e-mail and its attachments are intended for the above named 
recipient(s) only and are confidential and may be privileged.
If they have come to you in error you must take no action based 
on them, nor must you copy or disclose them or any part of 
their contents to any person or organisation; please notify the 
sender immediately and delete this e-mail and its attachments from 
your computer system.

Please note that Internet communications are not necessarily secure 
and may be changed, intercepted or corrupted. We advise that 
you understand and observe this lack of security when e-mailing us 
and we will not accept any liability for any such changes, 
interceptions or corruptions. 

Although we have taken steps to ensure that this e-mail and its 
attachments are free from any virus, we advise that in keeping 
with good computing practice the recipient should ensure they 
are actually virus free.

Copyright in this e-mail and attachments created by us belongs 
to Littlewoods. 

Littlewoods takes steps to prohibit the transmission of offensive, 
obscene or discriminatory material.  If this message contains 
inappropriate material please forward the e-mail intact to 
postmaster@xxxxxxxxxxxxxxxxx and it will be investigated. 
Statements and opinions contained in this e-mail may not 
necessarily represent those of Littlewoods.

Please note that e-mail communication may be monitored.

Registered office: 
Littlewoods Retail Limited, 
Sir John Moores Building, 
100 Old Hall Street, 
Liverpool,
L70 1AB 
Registered no: 421258  

http://www.littlewoods.com 
***********************************************************************
*********************************************** 
This Weeks Sponsor: Jetro Platforms
Introducing the first multi-protocol server-based computing solution.  Jetro
CockpIT and BoostIT allow enterprises to centrally manage applications in
Web, local applications and server-based computing protocols.
http://www.jp-inc.com
************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm


****************************************************************************


SMOKE ALARMS SAVE LIVES

Go to London Fire at www.london-fire.gov.uk/firesafety 

This email is confidential to the addressee only. If you do not believe that
you are the intended addressee, do not use, pass on or copy it in any way.
If you have received it in error, please delete it immediately and telephone
the number given, reversing the charges if necessary.
*********************************************** 
This Weeks Sponsor: Jetro Platforms
Introducing the first multi-protocol server-based computing solution.  Jetro
CockpIT and BoostIT allow enterprises to centrally manage applications in
Web, local applications and server-based computing protocols.
http://www.jp-inc.com
************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm


*********************************************** 
This Weeks Sponsor: Jetro Platforms
Introducing the first multi-protocol server-based computing solution.  Jetro
CockpIT and BoostIT allow enterprises to centrally manage applications in
Web, local applications and server-based computing protocols.
http://www.jp-inc.com
************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm


****************************************************************************


SMOKE ALARMS SAVE LIVES

Go to London Fire at www.london-fire.gov.uk/firesafety 

This email is confidential to the addressee only. If you do not believe that
you are the intended addressee, do not use, pass on or copy it in any way.
If you have received it in error, please delete it immediately and telephone
the number given, reversing the charges if necessary.
*********************************************** 
This Weeks Sponsor: Jetro Platforms
Introducing the first multi-protocol server-based computing solution.  Jetro
CockpIT and BoostIT allow enterprises to centrally manage applications in
Web, local applications and server-based computing protocols.
http://www.jp-inc.com
************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm
*********************************************** 
This Weeks Sponsor: Jetro Platforms
Introducing the first multi-protocol server-based computing solution.  Jetro 
CockpIT and BoostIT allow enterprises to centrally manage applications in  Web, 
local applications and server-based computing protocols. http://www.jp-inc.com
************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm


*********************************************** 
This Weeks Sponsor: Jetro Platforms
Introducing the first multi-protocol server-based computing solution.  Jetro 
CockpIT and BoostIT allow enterprises to centrally manage applications in  Web, 
local applications and server-based computing protocols. http://www.jp-inc.com
************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link.

http://thethin.net/citrixlist.cfm

Other related posts: