Newsgroup: it.comp.os.dos
Titolo: find command

When I redirect the FIND output to another file it adds a 'stupid' header I 
don't want; see example:
---------- MRPRODUT.TXT
101,'Wine Coolers 1'
11,'Cooling 1'
12,'Cooling 2'
13,'Cooling 3'
How can I remove it?
-- 
ABC

 wrote:

find "string" < file.txt
-- 
Posted via a free Usenet account from 
http://www.teranews.com

 wrote in message
news:Xns98F27CB2ADF1Fe...@212.35.56.33...

FIND "Cool" < file1 > MRPRODUT.TXT
-- 
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)


 
ottimo, grazie a entrambi
-- 
/-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\


Easiest way is to not generate it in the first place. Instead of:
find "Cool" filein >fileout, use
find "Cool" <filein >fileout
-- 
John Savage                   (my news address is not valid for email)

 ABC
***   Try using the "/V" switch. Type "FIND /?" for information.
Richard

 find "Cool" <filein >fileout
Spooky!
By the way, I'm usually looking for a word in a file somewhere in a
directory, so I enter:
for %f in (*.txt) do find /i "earthlink" %f >> el.fnd
Could I do that with the "less-than" somehow?
But what I really don't understand is how FOR can sometimes interpret
what's in the parentheses as filespecs and sometimes as other things,
such as strings or commands.  Is there something tricky there, or is it
perfectly sensible?  (The syntax help only confuses me.)
-- 
Marshall Price of Miami
Known to Yahoo as d021317c

perfectly sensible?  (The syntax help only confuses me.)
That sounds like NT stuff; you'll need to ask on a windows group for
help with that.


 help with that.
I don't see why it sounds like NT stuff. The following are perfectly legal
FOR commands in MSDOS/Win9x/Me systems.
::1 Wildcards return existing files.
FOR %? in (*.txt) DO ECHO %?
::2 Strings contain no wildcards.
FOR %? in (filename.exe foo bar 1 2 3) DO echo %?
::%? contains the strings regaurdless of if it exists
::3 Commands are same #2 (except position of %? is moved).
FOR %? in (SHIFT ECHO CALL DEL GOTO:LABEL) DO %? filename.bat
::4 Combinations
FOR %? in (fo?.bat del:foo.bat) DO call %?
Although, OP may well have been refering to /F or "tokens=" or "delims" or
%~f? as being confusing, which as you indicate, are not related to alt.msdos
or it.comp.os.dos.


 FOR %? in (fo?.bat del:foo.bat) DO call %?
You're right; I'm not talking about NT stuff.  But I'm still terribly
confused, as you shall see!  :-)
Is it a general rule that any item within the parentheses that contains
a wildcard refers to files in the current directory, while anything that
doesn't is a string, though it can be used to identify a file or command
in the DO part?
First, I take it that the question mark in "%?" behaves just like a
letter of the alphabet.  That is, it's not a wildcard, right?
In example 3, the SHIFT boggles my mind!  I thought it was only used
within .BAT files and took no arguments.
So what happens is:
SHIFT filename.bat
ECHO filename.bat
CALL filename.bat
DEL filename.bat
GOTO:LABEL filename.bat
Does the GOTO escape from the FOR loop?  How does that work?  Does it
run filename.bat with an immediate jump to LABEL somehow, and fail
gracefully if LABEL isn't in filename.bat?
Isn't filename.bat already deleted?!
Example 4 basically does this, assuming FOA.BAT, FOB.BAT and FOC.BAT exist:
CALL FOA.BAT
DEL FOO.BAT
CALL FOB.BAT
DEL FOO.BAT
CALL FOC.BAT
DEL FOO.BAT
Right? (The colon in "del:foo.bat" is new to me.  I don't understand it.)
Is there an attempted CALL of FOO.BAT, even though it's gone?
Or should it be:
CALL FOA.BAT DEL:FOO.BAT
CALL FOB.BAT DEL:FOO.BAT
CALL FOC.BAT DEL:FOO.BAT
Or:
CALL FOA.BAT
CALL FOB.BAT
CALL FOC.BAT
CALL DEL:FOO.BAT


 CALL DEL:FOO.BAT
As I indicated above, if the batch author wrote code to assure FOA, FOB and
FOC would not exist, then all it would do is CALL and DEL FOO.BAT as the
author intended.
For example...
@echo off
for %%? in (md cd) do %%? mytmp
echo do something useful>foo.bat
for %%? in (call del) do %%? foo.bat
for %%? in (cd.. rd:mytmp) do %%?
That said, my post was not intended to be a one stop newcomer instruction
manual, rather a demonstration that it does require NT to perform these
actions as my "I don't see why it sounds like NT stuff" lead-in indicated.
Sorry if anyone read more into the examples than was intended. Think outside
the box!
