Questions tagged [findstr]

findstr is a Windows command that searches for patterns of text in one or more files using regular expressions.

Useful links:

  1. FINDSTR on technet.
  2. FINDSTR on SS64 help pages.
730 questions
10
votes
4 answers

How do I redirect output into Gvim as a list of files to be opened?

I would like findstr /m background *.vim | gvim to open all *.vim files containing background in a single instance of gvim - but I can't get the piping to work. This is very similar to this question but instead of capturing the stdin output I would…
E.Beach
  • 1,829
  • 2
  • 22
  • 34
9
votes
1 answer

How to search for the exact match of string(s) using the windows `findstr` command?

How to search for the exact match of string(s) using the windows findstr command? For example: I need to find only the exact match the string store but not stored, storeday, etc. The below command returns all strings, store, stored and…
m.joe
  • 105
  • 2
  • 2
  • 8
9
votes
4 answers

FINDSTR and skipping folders

I'm new to Windows batch programming and to Stack Overflow, so please forgive me if I ask anything that's blatantly obvious to you seasoned, talented folks. I'm using Windows batch (.bat) to find files containing a certain string using findstr.…
Alex A.
  • 5,466
  • 4
  • 26
  • 56
9
votes
1 answer

findstr command to find a phrase instead of a single word

findstr /S "stored procedure" *.* returns all the files with the string "stored" as opposed to "stored procedure". Does anyone know what I am doing wrong? Thanks
user1298925
  • 2,304
  • 7
  • 29
  • 43
7
votes
1 answer

CMake: How to call execute_process with a double quote in the argument? a.k.a. Using find from CMake to count lines matching a string

I will like to call the command find from within a execute_process. The format of the find command is: find [/v] [/c] [/n] [/i] [/off[line]] "" [[:][][...]] So, the string has to be double quoted. However, if in cmake…
Antonio
  • 19,451
  • 13
  • 99
  • 197
7
votes
1 answer

batch find command not working

does anyone know why this would not work (Windows 7, batch script)? C:\testing>FINDSTR /R /N "^.*$" test.txt | FIND /C ":" FIND: `/C': No such file or directory FIND: `:': No such file or directory
Fractal
  • 1,748
  • 5
  • 26
  • 46
6
votes
3 answers

How to specify whitespace in findstr on Windows?

I want to specify whitespace after a certain word (SetupAX) that I am searching in a file. I am trying the findstr command this way - findstr /n /r "SetupAX[ \r\n\t]" XYZ.frm However, this doesn't work. If I don't put the whitespace, I get…
CodeBlue
  • 14,631
  • 33
  • 94
  • 132
6
votes
2 answers

Grep for windows

Old.txt contains apple orange banana And New.txt contains apple orange banana grape lemon I can access new contents which are added to New.txt using grep command. grep -Fxvf Old.txt New.txt > difference.txt Now, difference.txt…
Musie Meressa
  • 121
  • 1
  • 1
  • 8
6
votes
2 answers

Windows Batch: Search all files in file, if line contains "apple" or "tomato" echo it

I'm trying to write a simple batch that will loop through every line in a file and if the line contains "apples" or "tomato" then to output that line. I have this code to find one string and output it but I can't get the second in the same batch. I…
Jsn0605
  • 203
  • 3
  • 5
  • 13
5
votes
2 answers

Why does `findstr` with variable expansion in its search string return unexpected results when involved in a pipe?

While trying to provide a comprehensive answer to the question Why is FindStr returning not-found, I encountered strange behaviour of code that involves a pipe. This is some code based on the original question (to be executed in a batch-file): rem…
aschipfl
  • 33,626
  • 12
  • 54
  • 99
5
votes
1 answer

How to extract a substring with findstr

I'm trying to extract a substring with a Windows command. I want to extract a number that looks like this: 1.2.3.4 or more exact [anyPosInteger.anyPosInteger.anyPosInteger.anyPosInteger]. I thought I was doing that with the regex. Here is the…
user2034859
  • 577
  • 1
  • 9
  • 20
5
votes
1 answer

How to force `findstr` to ignore `Cannot open` returns

I'm trying to use findstr to search inside a folder looking for some string: findstr /spin /c:"string" * however it returns back with a lot of Cannot open errors which make it difficult for me to find the exact matches found. When using Cmder…
Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
5
votes
4 answers

How to use FINDSTR in PowerShell to find lines where all words in the search string match in any order

The following findstr.exe command almost does what I want, but not quite: findstr /s /i /c:"word1 word2 word3" *.abc I have used: /s for searching all subfolders. /c: Uses specified text as a literal search string /i Specifies that the search…
RayBacker
  • 166
  • 1
  • 2
  • 12
5
votes
2 answers

(powershell) Select-String vs Findstr

This is very simple... why first command working and second no? Findstr looks to me for best use in "dos"like commands and not in powershell. Get-AppXProvisionedPackage -online | findstr ^DisplayName Get-AppXProvisionedPackage -online |…
AnimaliX
  • 55
  • 1
  • 7
5
votes
1 answer

How to use OR operator with command FINDSTR from a Windows command prompt?

Findstr is supposed to support regular expressions and the way I am using it I need to have an OR to check if a file ends in .exe OR .dll. However I cannot get the OR operation to work. Windows thinks on using | that I try to pipe the previous…
Matthew Lueder
  • 953
  • 2
  • 12
  • 25
1
2
3
48 49