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
4
votes
2 answers

Batch Script to delete files based on findstr regex

I'm trying to delete some files with a batch script, based on a regular expression. What I have is: FOR /f "tokens=*" %%a in ('dir /b | findstr MY_REGEX_HERE') DO ECHO %%a I know my inner command works on its own, giving me the list of…
Retsam
  • 30,909
  • 11
  • 68
  • 90
4
votes
1 answer

Findstr -- exclude a file type -- search only ascii

I want to run a FINDSTR dos command in a way beyond what it is easily found in "findstr /?". How would I run findstr so that it only searches ascii files. (I am not sure if that is possible. My gut feeling is that it is not possible) …
xarzu
  • 8,657
  • 40
  • 108
  • 160
3
votes
5 answers

How to match IP address by using 'findstr'? Or any other method of batch in windows

    As the title said, I want to match ip address with batch in windows, please tell me how I can do it?     I see that "findstr" can match with regex like "[0-9]", but how can "findstr" matches it appears one to three times?
mts
  • 109
  • 2
  • 3
  • 10
3
votes
2 answers

FindStr isn't work correct

I made a piece of batch-code, and I thought this will work. What I'm thinking that this code is doing? I have some plugins and I want to test if the deploy correct. So I get the pluginlink from the plugins.txt. Then I get the plugin from SVN with…
Danny Gloudemans
  • 2,597
  • 7
  • 39
  • 57
3
votes
2 answers

Delete line of a text file with batch

I saw that in batch, to delete a specific line from a text file, you need to do it with findstrthat allow you to find your line and then delete it. But is there a way to do it when you don't know the line ? I got another program that fills the file…
Quantum Sushi
  • 504
  • 7
  • 23
3
votes
6 answers

Escaping a backslash in Batch File using FINDSTR

In my svn Pre commit hooks I use findstr to block certain file types beign committed. I now want to extend this to directories, in the first instance \obj\ directories however I am having problems with the Regular expression and escaping the \ of…
Dean
  • 5,896
  • 12
  • 58
  • 95
3
votes
2 answers

Double quotes in delims=?

I'm very new to batch scripting, but in my last question I was trying to extract a link from a line of text, specifically: 83: href="https://beepbeep.maxresdefault.rar">
theboy
  • 353
  • 2
  • 10
3
votes
2 answers

SVN Pre Commit Hooks

I am currently trying to extend our already existing (and working) pre commit batch file for committing to SVN. The first part blocks any commit that does not have comments and works as expected. The second part is an attmept to block users…
Dean
  • 5,896
  • 12
  • 58
  • 95
3
votes
1 answer

problems in findstr output to file

I am trying following command findstr /RC:"h25v06.*hdf\"" "index.html" >temp.txt getting following out put index.html:[   ] FINDSTR: Cannot open…
3
votes
1 answer

Batch - IF ELSE Condition for start function executes regardless

sorry in advance if theres a thread on here to answer my question, I've been stuck on this since friday and was searching around. I did find some similar-ish problems but none I could apply or adapt to this (to my knowledge). In short, I have a…
LMacs
  • 57
  • 3
  • 10
3
votes
2 answers

findstr not working with string containing dash (-)?

I've been working on a BAT file which will delete old files based on creation date. To do this I've generated a list of all files and paths, then a list of files names to be protected. FINDSTR is then used to remove these files from the list of…
Domenic
  • 31
  • 1
3
votes
1 answer

Remove part of string in file using batch

I have some data in a text file (test.txt), reading: wantedunwanteddata I want to remove the "unwanted" part in that string and output the rest (i.e. "wanteddata" in another file (test2.txt). I'm using: findstr /v "unwanted"…
user3552829
  • 103
  • 1
  • 4
  • 13
3
votes
1 answer

Searching for strings contained in file1 that are NOT FOUND in file2

I'm trying to run a search command to lookup strings from file1 and find them in file2. I then want to print ONLY the strings from file1 that are NOT FOUND in file2. File1 would be something like: read write access File2 would be: 0xFF88 T…
Dragonfly
  • 31
  • 1
3
votes
1 answer

Visual Studio 2015. How to find less files with specific classes

I was wondering if there was an easy way, in Visual Studio 2015, to "navigate to" a less-file in a solution containing a specific css-style? If I use the search-function (ctrl+f) or find-in-files (ctrl+shift+f) I also find occurances in the…
Frode
  • 3,325
  • 1
  • 22
  • 32
3
votes
1 answer

Deleting duplicate text lines using a batch file

I am creating a text file that displays a file extenstion of each file in the folder. I want to get rid of duplicate since it creates a line of text for each file. After a bit of searching, I figured out I should use findstr to overwrite the initial…
iaureee
  • 33
  • 4