Filter a text file into a new text file - windows

Sorry about the dummy question here.
Under Windows I would like to be able to filter one .txt file into a new one. Filtering all lines that contain a specific string.
I know this could well be a really easy one, but would really appreciate a few pointers please.

Use the findstr command:
findstr my-string filename > new-file
findstr /? will give you a usage message telling you how to use findstr (including the /V switch if you wanted to filter lines out rather than filtering them in.)
Or if you're familiar with grep and wishing you had it on Windows, install Cygwin. :-)

Powershell has some neat string comparison features. You can pipe the output to a new file.
^^ There are some better links as to how to use Powershell - but I can't find them this minute. If you go the Powershell route there are lots of examples on the internet.

Visual Studio Add On Text Power Tools contains a very powerful filter feature.
The one issue is the Visual Studio add-ons have a file size limit (this may be resolved by the time you read this). Visual Studio may open a large file that is not the issue, the issue is add-ons are restricted to a file size limit.

There's a logfile filtering utility Logfilter (www.casstor.com), that can easily do this. You can define multiple filter strings as well as use regular expressions in your filters. I think it might be what you're looking for.

Related

Windows 11 - Not kind sort command for viewing all files in subfolders

I used to use a sort command when trying to view all files across a bunch of folders at once. It makes sorting files easier. I do know part of the command was written as not sort kind, however I am unable to remember which parts need to be capitalised, and where the colon (:) goes. I have trying googling the answer, and even gone through hours of YouTube videos trying to find the answer. I would prefer not to use the asterisk (*) command or the DIR command Screenshot showing one of many attempted iterationsas that is not suitable for my use. Thank you.
I have since been alerted on StackExchange that the answer to the issue I was having is kind:NOT Folder.

Windows search: how to find all files with specified extension and wildcard (like *.csv, *.log, etc)

Using the search input box in File Explorer, how do I find a filename with a specific extension?
Minimal, Complete, Verifiable Example
I'd like to recursively find all comma-separated files in a folder, typically with a .csv extension. For what reason I cannot fathom, all of the following attempts fail to provide this result; they give me a massive list of stuff that I don't need:
*.csv
.csv
name: *.csv
name:=*.csv
I would expect at least one of these to simply print all files with a .csv extension in a sortable list.
This is one of those maddening things that should be simple, but for some reason, is not. I will resist the urge to use profanity, and pine for the search from UNIX, Linux, Windows XP, etc.. which actually make sense.
I just use "csv" and make sure "All subfolders" is selected
Windows Desktop Search: Advanced Query Syntax:
ext:.csv
Windows 7: Advanced tips for searching in Windows:
System.FileName:~>".csv"
Not sure if there is a trick to stop it searching compressed containers or force it to search the entire disk instead of just the index.
Windows Search can never be trusted to find all files, use Everything, Agent Ransack or similar 3rd-party tools if you really are serious about file searching.

Searching for files with specific file content

I am trying to edit lot of files which has specific file content. I need to search for those files which have some content.
Is there any software which can do this type of search with huge accuracy.
I have tried searching using Windows 7 but looks like it misses many files.
Thanks.
The Windows native search can be quite limited ...
I'd suggest you look at the File Content Finder app on the Windows app store (disclaimer - I'm its developer). It's specifically designed for searching file contents without indexing. It supports all major file formats - pdf, doc(x), xls(x), pptx, and others. It can even search scanned documents.
Its filtering lets you optimise and refine your search by multiple criteria - file type, creation/modification dates, etc.
You can use FIND "string" pathname or FINDSTR "string" pathname(s)from the windows command line. See this guide.
I face this issue on a daily basis, and I've come up with two solutions:
Text editors, supporting the "find in file" feature (Notepad++ being a simple, free example).
Ubuntu app (from Canonical Group): UNIX/Linux supports finding in files, using the command find . -exec grep ....
As far as Windows search is concerned, its quality has reduced that heavily the latest versions that I've decided not to use it anymore.

Is it possible to edit file details of multiple files at once? (Windows 7)

I'm wondering if it's possible to change the file details, in this case of music files (Title, Artists, Track #, etc) of more than one file at once, or in rapid succession with a batch file or command of some kind, instead of changing each individually through the properties window.
Try Mp3tag you can do all kinds on activity you have mentioned..
Its Portable too..!
Had the same problem and found a helpful website:
http://www.howtogeek.com/111859/how-to-batch-rename-files-in-windows-4-ways-to-rename-multiple-files/
Most flexible way is via command prompt and a command similar to this:
ren *.html *.txt

How do I make sense of a batch file?

I have no prior experience working with batch files or shell scripting in general. I need to understand the operations being carried out by a batch file used in a related project. Any resource that gives exhaustive list of batch file commands and what each one does?
Once you get acquainted with the general .BAT file information, using some of the pointers to useful information that other users have posted in the other answers, you might try some of the following strategies that help you understand and analyze the BAT files used int your projects:
add an ECHO command in front of all command invocations
read HELP command for each command line in the BAT file
execute at the command prompt each command line in the BAT file
remove the #echo off at the top of the .BAT file, and see how the BAT progresses
add some PAUSEs to keep viewing some commands on screen before they disappear.
There are some useful answers here in this Stack Overflow question: Best free resource for learning advanced batch-file usage?
As well there are quite a few resources available through google search for Batch file resources, as well as the Wikipedia entry http://en.wikipedia.org/wiki/Batch_files
That should get you started at least.
A little search on google should give a lot of tutorials and websites with information on writing them for both Windows and Linux.
Maybe you should start from the beginning though.
http://ss64.com/nt/
http://academic.evergreen.edu/projects/biophysics/technotes/program/batch.htm
http://www.robvanderwoude.com/batchcommands.php
http://en.wikipedia.org/wiki/List_of_MS-DOS_commands
They're just a few examples i found with a little google search. You should search it and find something thats better for you.
Hope this helps.

Resources