windows script to copy text from one file into a new file
5,304
I suggest using PowerShell instead of Batch. It is much more powerful and easier.
The only commands you need are Get-Content
and Where-Object
:
Get-Content in.txt | Where-Object { $_ -match "started processing" -or $_ -match "file" } >> out.txt
This will copy all lines containing either "started processing" or "match" to a file called "out.txt".
Related videos on Youtube
Author by
Sam
Updated on September 18, 2022Comments
-
Sam almost 2 years
I am noob at coding! I am trying to create a windows script that I can copy text from one file into another. My main goal is to find lines in the text with "started processing" and "file". I am hoping I can make this a batch file! If someone can help I would be very grateful.
Thanks
P.S. I am using Windows 7 Server edition
-
user1343503 over 10 yearsHave you tried to use FINDSTR and redirect the output to a file?
-