Hi there!
Hopefully someone around here is so kind to help me out.
How can i merge the contents of several textfiles into one easily?
Then i need to filter the file: i only need the lines with a certain word in it.
Preferably i need a macrocode for this, but if there is a 2 or 3 click manual procedure for it, that would be very welcome too!
Thanks in advance!
merging text files & select specific lines
Moderators: AmigoJack, bbadmin, helios, MudGuard
-
utreg-4ever
- Posts: 1
- Joined: Fri Oct 05, 2007 8:45 am
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Here are the steps to take.
You can open the first file, then do Edit/Insert/Filename or Files......
(Maybe do SaveAs a new file name).
Then you can Bookmark lines that meet a Find spec for the "word".
Then Search/Invert All Bookmarks
Then Edit/Delete/Bookmarked lines.
(Maybe do SaveAs a new file name).
That will leave you with only those lines that have the "word" you did a Search for.
You can open the first file, then do Edit/Insert/Filename or Files......
(Maybe do SaveAs a new file name).
Then you can Bookmark lines that meet a Find spec for the "word".
Then Search/Invert All Bookmarks
Then Edit/Delete/Bookmarked lines.
(Maybe do SaveAs a new file name).
That will leave you with only those lines that have the "word" you did a Search for.
Hope this was helpful.............good luck,
Bob
Bob
Bob's suggestion will of course work, I've never even noticed the 'Insert Files' before (!) - and wouldn't have thought of Find/BookmarkAll/Invert - my suggestion is somewhat different, so take your pick...
Ctrl-F5 / Find in files
The results go to the 'Search Results' window - with the advantage that you can double-click a line to go straight to that line in that file. If you need to save the output separately, you must CopyAll in the Search Results window, then paste into another document, then edit out the prefix on each line that TP has added - you can do this in one go with an appropriate regex/null to find/replace.
If the set of files covers multiple directories not all with the same root, you can direct the 'Find in Files' dialogue to use a list of files in another text file by entering @[path]/filelist.txt in the 'In Files' input box.
[This latter method has a minor bug in that it iterates over all sub-folders and repeats the results as many times as there are sub- (and sub-sub-) folders. Specify an empty 'In Folder' directory to prevent this: your filelist.txt file includes the path for each file.]
Ctrl-F5 / Find in files
The results go to the 'Search Results' window - with the advantage that you can double-click a line to go straight to that line in that file. If you need to save the output separately, you must CopyAll in the Search Results window, then paste into another document, then edit out the prefix on each line that TP has added - you can do this in one go with an appropriate regex/null to find/replace.
If the set of files covers multiple directories not all with the same root, you can direct the 'Find in Files' dialogue to use a list of files in another text file by entering @[path]/filelist.txt in the 'In Files' input box.
[This latter method has a minor bug in that it iterates over all sub-folders and repeats the results as many times as there are sub- (and sub-sub-) folders. Specify an empty 'In Folder' directory to prevent this: your filelist.txt file includes the path for each file.]