Web Hosting, Design, & Coding forum

General discussion

FINDSTR COMMAND(DOS)

by Shadow-28 / April 12, 2006 9:31 PM PDT

hi,

FINDSTR /G:INPUT.TXT DETAILS.TXT > OUTPUT.TXT

Here in INPUT.TXT has 1006 entries, I would like to pick from details.txt where an exact match occurs.

i.e if details.txt has

1006
345100678

it should pick only first row.What command can I use

Thanks

Discussion is locked
You are posting a reply to: FINDSTR COMMAND(DOS)
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: FINDSTR COMMAND(DOS)
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
" /x : Prints lines that match exactly. "
by R. Proffitt Forum moderator / April 12, 2006 10:17 PM PDT
In reply to: FINDSTR COMMAND(DOS)
Collapse -
hi
by Shadow-28 / April 13, 2006 12:59 AM PDT

hi thanks,

I was not clear the first time around.

Lets put it this way


INPUT.TXT

1600

DETAILS.TXT

984567 qwer 1600 tyurr
2345 poiuy 222 1600
98416009 222 pmj

Now , I would like rows 1 & 2 to be selected , but row 3 to be rejected(because it has 1600 embedded in a number...it is not exactly the number)

/X is not working out here.

Thanks

Collapse -
Search for " 1600" rather than "1600"
by R. Proffitt Forum moderator / April 13, 2006 2:32 AM PDT
In reply to: hi

I did not check if findstr does this. However you could use other filters such as grep or other to filter such.

Bob

Collapse -
you need to use a regular expression
by ramarc / April 13, 2006 4:29 AM PDT
In reply to: hi

findstr /R "\<1600\>" details.txt

will produce

984567 qwer 1600 tyurr
2345 poiuy 222 1600

you'll need to wrap your search argument in '\<' and '\>'. you can either write a loop to read each line in your input file and call findstr with
or change your input file to include the reg exp syntax.

Collapse -
answer is
by meetjanu / December 31, 2012 1:34 AM PST
In reply to: FINDSTR COMMAND(DOS)

goto web\catalog
findstr /mspin /c:"string" *.* > string.txt

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

The Samsung RF23M8090SG

One of the best French door fridges we've tested

A good-looking fridge with useful features like an auto-filling water pitcher and a temperature-adjustable "FlexZone" drawer. It was a near-flawless performer in our cooling tests.