Struggling to find a way to extract lines from a file by reference to a pattern match, WITHOUT deleting the remaining lines. I want to send the extractions to different files. Extract lines and Remove lines seem to work by nuking what is left. For example, I have a file that has this contents
12345
123
333345
333345
65777
897777
934444
So I want an extraction function that first takes all lines beginning with "1" to "1.txt"
Then an extraction function will take all lines beginning with "3" to 3.txt
and so on.
Extract lines without deleting remainder
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
-
- Posts: 20
- Joined: Fri Jun 05, 2009 11:11 pm
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Extract lines without deleting remainder
Easy - use a Filters\Restrict\Restrict to lines matching pattern list.
And inside this, put a Filters\Special\Secondary output filter
The original text will flow on unchanged, with matching text pushed out to the new file.
And inside this, put a Filters\Special\Secondary output filter
The original text will flow on unchanged, with matching text pushed out to the new file.
-
- Posts: 20
- Joined: Fri Jun 05, 2009 11:11 pm
Re: Extract lines without deleting remainder
Got it, thanks Simon