Neil’s recommendation is that same as I was just composing.
Be sure to operate on a copy of the original file as you test the steps.
People here can review your regular expressions as you try them.
— Bruce
_bruce__van_allen__santa_cruz_ca_
> On Nov 4, 2024, at 8:53 AM, Neil Faiman <[email protected]> wrote:
>
> As far as I know, BBEdit simply supports sorting lines — not arbitrary
> records represented by batches of text lines. But do not despair. All is not
> lost. BBEdit has really robust support for sorting lines.
>
> I would start with a GREP that could match across multiple lines and collapse
> them into a single line, with some arbitrary separator character representing
> where the original line breaks were. (You might need two patterns, one to
> collapse the multi-line Comments into a single line, and then a second one to
> collapse all the line in the record into a single line.
>
> Now that each record is represented by a single line, you can write a regular
> expression that recognizes the sort keys within the line. Then you can use
> the “Sort using pattern“ feature of the Text > Sort Lines… command to sort
> the records on those keys.
>
> Finally, you can reverse the process from the first step and split the
> records back into multiple lines.
>
> Once you’ve got each of the steps perfected, you can create a text factory
> that will apply them to a file automatically, and you should be good to go.
>
> Good luck,
> Neil Faiman
>
>> On Nov 4, 2024, at 11:35 AM, Howard <[email protected]> wrote:
>>
>> I have multiple records in a text file in the format below (seven sample
>> records shown). I want to sort all of them by Author and then, within
>> Author, Created At. In a record, the first four lines are always just one
>> line; however, the fifth line (Comment) can be up to 30-40 lines, possibly
>> more).
>>
>> Is this something that BBEdit can do? If it is, how can I do it?
>
>
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or believe that the application isn't working correctly, please email
> "[email protected]" rather than posting here. Follow @bbedit on Mastodon:
> <https://mastodon.social/@bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/bbedit/B3ABB4DB-E670-4991-8155-2ED358198C1D%40faiman.org.
--
This is the BBEdit Talk public discussion group. If you have a feature request
or believe that the application isn't working correctly, please email
"[email protected]" rather than posting here. Follow @bbedit on Mastodon:
<https://mastodon.social/@bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/bbedit/97A63046-FD1D-4CFC-9479-95488580F5E6%40cruzio.com.