Extract lines matching pattern list - sort output

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
evilowl
Posts: 3
Joined: Thu Apr 12, 2012 11:10 pm

Extract lines matching pattern list - sort output

Post by evilowl »

Good day.

Whether it's possible putting extracted lines in output file in the same order in which they were found?

Here is an example:

Extract lines matching perl pattern/using this text:

41401
41484
41486
41556

Output looks like this:

/done/DiB-41486 Auto Repair & ServiceBrake Repair.xls
/done/FM-41401 Locate Dealer Get A Quick Quote Estimate Payments.xls
/done/TS-41484 Home Improvements.xls
/done/TS-41556 Building Materials.xls

I need this:

/done/FM-41401 Locate Dealer Get A Quick Quote Estimate Payments.xls
/done/TS-41484 Home Improvements.xls
/done/DiB-41486 Auto Repair & ServiceBrake Repair.xls
/done/TS-41556 Building Materials.xls

i'm trying to sort output, but couldn't, because sought-for parameter of sort (5 digits) placed in lines haphazardly

Please help.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Extract lines matching pattern list - sort output

Post by DataMystic Support »

Just match the EasyPattern

/done/[ capture(1+letters) as 'code', '-', capture(5 digits) as 'digits', longest 1+ not cr or lf) ]

Replace with

@digits@,$0

Then you can sort based on the first 5 digits of the line, then remove this column later on.
evilowl
Posts: 3
Joined: Thu Apr 12, 2012 11:10 pm

Re: Extract lines matching pattern list - sort output

Post by evilowl »

Thank you very much.
Post Reply