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
-1
votes
3 answers

Find string in multiple .txt files

I have a folder with many .txt files. I would like to find string "X" in all of these files then I would like to copy the found strings into .txt files into a different folder. So far I have tried : @echo on findstr /m "X"…
MALKAVIAN
  • 131
  • 14
-1
votes
1 answer

escaping quotes in findstr

What changes need to be made to the following findstr command in order to return a list of all the uses of the exact phrase "port" : " in all the files contained in the directory and subdirectories? findstr /I "port" : " * Obviously, escaping…
CodeMed
  • 9,527
  • 70
  • 212
  • 364
-1
votes
1 answer

find a string in a text file and copy finded string into a variable value in cmd

I want search in the text file and copy contents in value of variable my text file name is pass and that's content is only 123 i want var value be 123 set var=123
Mr.alone92
  • 11
  • 3
-1
votes
2 answers

How to find a certain word in a file without using ERRORLEVEL (batch)

I can use ERRORLEVEL, but tried and with a loop it failed. I am writing a batch "shell." Since I have tried and tried, I am finally asking for help. The reason I don't want to use errorlevel is because the loop. (FULL) SHELL @set /p…
Expto
  • 53
  • 2
  • 12
-1
votes
2 answers

Grab IP addresses only by pinging list of server names using Batch

I have a text file containing a list of a few hundred server names Server1 Server2 Server3 Server4 and so on... I want to run a batch file which will take this file , ping all of them and return just the IP address if found, or "DOWN" if…
codex2090
  • 3
  • 1
  • 3
-1
votes
2 answers

Use of findstr to seach regular expression in a batch file

I would like to create a batch file to check if the file name has been written following certain rules. The file name contains some parameters (letters and numbers) splitted by an hyphen character like : FIN73-INV-2015-ANN I would like to check the…
bantonacci
  • 29
  • 3
-1
votes
2 answers

Search for text1 AND text2 in a line of file.txt

I am trying to return results only for lines that contain matching text via cmd. In this case the line must match in both "Name" and "Surname". Read though http://ss64.com/nt/findstr.html, and tried the first example findstr "James Henry" sam.txt…
David
  • 127
  • 3
  • 10
-1
votes
1 answer

How to find a complete substring in another or in a variable

I have to Install/Uninstall some products with batch scripts and also use log files to check if Installed or Uninstalled... So if a product is installed correctly I have somewhere in my log file a line like this one (without quotes): "SOMETEXT…
-1
votes
1 answer

Findstr command prompt

I have some problems with findstr command in cmd. I got a text file and need to show lines that start with uppercase A but don't contain lowercase a. Generally what I aim to find out is how to search for a string that is a part of the word or a…
Jake
  • 67
  • 3
  • 10
-1
votes
1 answer

Finding files with a certain pattern in the filenames

I want to search the pattern only in the file names not in the file content. For content, I can use findstr but I want to search the filenames for the pattern.
-1
votes
2 answers

How to show a string that appears after specific string in a file with a batch?

I need to create a batch file that would show me a string printed after a specific string in some log file. For example: I have a log file with a line that ends with the string "Calculated number: XX". I want to create a batch file that would go to…
Slava
  • 1
  • 1
-2
votes
2 answers

Findstr in loop, batch file

I would like to ask you for a help. I have a text document colors.txt that contains many colors (hundreds of them, each on the separate line). For example: blue white yellow green magenta cyan white black Than I have folders, that contain…
Marek Majkút
  • 13
  • 1
  • 3
-2
votes
1 answer

batch: FINDSTR regular expression not work

echo a.txt| FINDSTR /R ".+\.txt$" not work and not even: echo a.txt| FINDSTR /R .+\.txt$ Why? Edit: Now works! echo a.txt| FINDSTR /R ..*\.txt$
Mario Palumbo
  • 693
  • 8
  • 32
-2
votes
1 answer

Using loops to rename filenames with batch script

I have a a folder with the files: File1.txt and File2.txt The contents of file1.txt are: "DTS053C0 RUN DATE 10/01/11 DATATRAK SYSTEM PAGE 001 RUN TIME 13:35:08 INPUT PROGRAM TRANSMISSION STATUS REPORT STATUS - INPUT RECEIVED BY DTCC'S DATATRAK…
Aditya
  • 3
  • 1
  • 2
-2
votes
1 answer

findstr command without the new line (the Enter keys)

I need to use findstr command without new line. My file "prova.txt" contains: La# Do# Fa# My batch file contains: @echo off FINDSTR Do# prova.txt The result of command is: Do# //second empty line Instead I wish it was: Do# How do I get this? I…
1 2 3
48
49