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.
Extract lines matching pattern list - sort output
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
- 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
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.
/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.
Re: Extract lines matching pattern list - sort output
Thank you very much.