0
I have a directory tree that contains ~150 files with a specific extension (.php
) organized into different folders. Some of these files are marked on line 2 to indicate a certain status. I know that this mark is always on line 2, and it always follows a specific format.
What I'm looking for is something (a command, a script, a program) that can search the directory for this mark and give me output like this, but in an easy-to-manipulate format:
An ideal solution would be one that can provide a list of ALL the .php
files, with line 2 of the file next to the filename. The list above does this for matched files only.
I've tried using find
in a for
loop:
for %f in (*.php) do find "Oracle Status" %f
But this only searches the current directory, and doesn't format it in a friendly way.
This is fantastic! I ended up making several tweaks to fit my needs (add items with status of "Untouched" if line 2 does not match, export to CSV, trim file path, sort, etc.), but you pushed me in the right direction! I suddenly love PowerShell. It's so underappreciated. <3 – cyberbit – 2016-06-16T18:31:00.223