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
2
votes
1 answer

FINDSTR in CMD - whole words only

I use Windows 7 and often use the FINDSTR command to search in * .log files. I would like to ask if it is possible to search for whole words only. Because often when I type: findstr "su" *.log I get: su super unsubscribe etc.
2
votes
1 answer

Looking for a string on a constantly changing file with a batch script

I have a .log file that is constantly being added new lines and I want to have a batch script that detects when the new line has a specific string. First, I copy the .log file and change it into a .txt Then I read the last line Here is an example of…
2
votes
1 answer

how to extract text from inside quotes using findstr

I have a directory full of files I am trying to findstr and extract whats inside the quotes my test G:\Games\Steam\steamapps\common\XXXXXXXXX\addons>findstr addontitle workshop\*.vpk workshop\XXXXXXXXX.vpk: addontitle "Addon…
2
votes
1 answer

findstr command variable expansion in path in for loop batch script(windows, batch script)

echo off set "MasterFolder=C:\Users\Development\test_folder" SetLocal EnableDelayedexpansion @FOR /f "delims=" %%f IN ('dir /b /s "%MasterFolder%\*.txt"') DO ( set /a "idx+=1" set "FileName[!idx!]=%%~nxf" set…
Joey Cho
  • 351
  • 1
  • 8
2
votes
0 answers

Excluding all lines from a file that match with a multi-value string

This looks for a string %exclude% in a file templist.m3u and puts mismatching lines into file files.m3u. findstr /irv "%exclude%" "%temp%\templist.m3u%" >%temp%\files.m3u The problem is that the string %exclude% can sometimes have multiple values,…
Bricktop
  • 533
  • 3
  • 22
2
votes
5 answers

How can I use findstr with newline regular expression

I'm on windows dos prompt. I have log file which contains log like: Timestamp: Order received for Item No. 26551 Timestamp: Exception: OutOfRangeException Timestamp: Message: Inventory Item is not stock. Item No. 23423 Timestamp: Order received for…
Morin
  • 227
  • 2
  • 4
  • 11
2
votes
1 answer

how to return a string with findstr in windows with matching substring

I have a string in a file like, async.AsyncTranslationThread - processPart: Finished Processing job number: J215577 partID: 151269 any many more. I want to return only that line which has substring Finished Processing job number I wrote a findstr…
Laxmi Kadariya
  • 1,103
  • 1
  • 14
  • 34
2
votes
2 answers

Use Windows findstr to list files not containing a string

From Windows CMD I can use findstr -m subroutine *.f90 to list all files with suffix .f90 containing "subroutine". To list all .f90 files not containing the string I can do something like dir /b *.f90 > files.txt findstr -m subroutine *.f90 >…
Fortranner
  • 2,525
  • 2
  • 22
  • 25
2
votes
1 answer

Batch file rename using regex to match 4-digit year

In a windows batch file, I would like to rename files containing a 4-digit year (ex: "1999") in the filename by simply wrapping the year string in parentheses. Example: home video 1998.avi home vid 1987.mov home_video (2002).avi would become home…
anthony
  • 282
  • 1
  • 3
  • 14
2
votes
0 answers

How to use FindStr with special characters?

I need to find the word ="HQDFSQL"/> using the FindStr command in a batch script. What query should I use to accomplish this?
2
votes
1 answer

BATCH: Escaping

Im trying to make simple batch file that would copy all lines with width="10 string from .htm file to .txt but im stuck with doublequote " symbol in the string My code: for /F "tokens=*" %%g in ('FINDSTR /C:"width=\"10" "htmfile.htm"') do (echo %%g…
2
votes
1 answer

Why does FINDSTR not find the searched string with space in my batch file?

So I am running a FINDSTR command to search a file for the text [errorCode: 0] and using the option /v to output the lines which do not contain this string. This is the used code: @findstr /i /v "\[errorCode: 0\]" file1.log >>file2.txt But this…
2
votes
0 answers

Text file search tool for Windows (command line) with an extremely large pattern list

Is there an efficient way to search a list of strings from another text file or from a piped output? I have tried the following methods: FINDSTR /G:patternlist.txt or Some program whose output is piped to FINDSTR SOMEPROGRAM |…
suri
  • 43
  • 7
2
votes
2 answers

Batch find text in file and replace with other text

I need to use Batch to check file Directory.twml to see if it contains any words from file blocked.twml and if it does replace with [Blocked] Here is an example of both files: Directory.twml 11:38:38.90 [System] Twml Has joined the…
Twml
  • 421
  • 1
  • 4
  • 10
2
votes
1 answer

Check if user input is in txt file, with batch

I am making a chat style system in batch for LAN networked computers. I want to check if a username is taken or not and if it is not allow it to be picked, How can I check if what the user inputs in this line (set /p name2=) I have tried this in a…
Twml
  • 421
  • 1
  • 4
  • 10