Get 1 line from more than 200 files with an expression and put them into 1 file with filename
-
Hey guys,
I have like 200 files, from which i gotta get out 1line/file which has an exact expression(“$hbox”). I have to systematize them, so I can work with them later much more easier. Also I have to know from which file are the lines from.Thought about something like this:
<line1> | <file1name>
<line2> | <file2name>
…I’d be glad if y’all could help me, even if not like how I imagined it!
I don’t really know the borders of notepad++ and I really don’t know where else i could ask for help or manage to do this, so if I’m at the wrong place, I’d be glad for some redirection.
-
Hello, @márk-birtalan, and All,
Natively, Notepad++ can show you all the files containing your string
"$hbox"
as well as all the lines containing this string ;-))Here is a quick road map :
-
Open the Find in Files dialog (
Ctrl + Shift + F
) -
Type in
"$hbox"
in the Find what: zone -
Type in
"$hbox"
, again, in the Replace with: zone ( To avoid problems in case of confirmation of the replacement ! ) -
Choose your file
filters
in the Filters zone, if any -
Type in the
absolute path
to your files to scan, in the Directory zone ( They must all belong to a same folder ) -
Untick the
Match whole word only
option ( IMPORTANT ) -
Tick the
Match case
option -
Select the
Normal
search mode -
Click on the
Find All
button
=> After searches, a Find result panel is displayed, containing all lines, with a string
"$hbox"
, of all your files scannedThen, while double-clicking on any line of that list, the associated file is selected/opened and cursor moves to the exact occurrence of the string
"$hbox"
, in the corresponding line !You may save all these locations, in a file :
-
Right-click in this panel and choose the
Select all
option -
Copy this selection in clipboard with the
Ctrl + C
shortcut ( do NOT use the context menuCopy
) -
Open a new tab (
Ctrl + N
) -
Paste the clipboard’s contents (
Ctrl + V
) -
Save this new tab
If you need some modifications in this raw output text, just tell me ;-))
Hope it helps you a bit !
Best Regards,
guy038
-
-
Thx for the help, really appreciate it :D