How to move #tags up to line above and sort doc by tags?

24 views
Skip to first unread message

David J

unread,
Aug 19, 2021, 1:20:31 PM8/19/21
to BBEdit Talk
I have a long text that I tagged, I'd like to move those tags up to the end of the last line they are under:
Original:
"What another would have done as well as you, do not do it. What another would have said as well as you, do not say it; what another would have written as well, do not write it. Be faithful to that which exists nowhere but in yourself — and thus make yourself indispensable." - André Gide
#Curiosity


"It always makes me proud to love the world somehow- hate’s so easy compared." - Jack Kerouac

#Love

"Your mind will answer most questions if you learn to relax and wait for the answer." - William S. Burroughs

#Questioning #Questions

How I'm trying to get it:

"What another would have done as well as you, do not do it. What another would have said as well as you, do not say it; what another would have written as well, do not write it. Be faithful to that which exists nowhere but in yourself — and thus make yourself indispensable." - André Gide #Curiosity


"It always makes me proud to love the world somehow- hate’s so easy compared." - Jack Kerouac #Love

"Your mind will answer most questions if you learn to relax and wait for the answer." - William S. Burroughs  #Questioning #Questions

Then is it possible to sort the doc by specific #tag names? I've read through the manual, but this is way out of my area. Thanks






Fletcher Sandbeck

unread,
Aug 19, 2021, 1:42:16 PM8/19/21
to bbe...@googlegroups.com
If the tags always start with hash marks then you can find "\s+#" and replace with " #". Basically you're just replacing whatever white space appears before each # with a single space.

For sorting you can look at Sort Lines... on the Edit menu. Sort with a pattern like "#.+" with Entire Match selected. That will sort by the tags on each line. Make sure that each paragraph is actually a single line. If you have stray returns in the text then those lines are going to be broken up.

As always, particularly with operations like global search replaces and sorting, make sure you work on a copy of your data.

[fletcher]


--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/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 bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/e155477c-b867-4fd9-bf53-e119d33c5b1an%40googlegroups.com.

Christopher Stone

unread,
Aug 19, 2021, 5:31:01 PM8/19/21
to BBEdit-Talk
On Aug 19, 2021, at 12:20, David J <future...@gmail.com> wrote:
I have a long text that I tagged, I'd like to move those tags up to the end of the last line they are under:


Hey David,

I'm thinking something like this:

Find:

\s+((?:#\w+\h*)+)

Replace:

“ \1”

** Without the quotes.


--
Best Regards,
Chris

David J

unread,
Aug 19, 2021, 8:06:27 PM8/19/21
to BBEdit Talk
Hi Fletcher and Chris.

I tried both your methods and they both worked for placing the tags. Then I used the pattern to sort lines and that worked as well. That is just wild and awesome!
I'd have sat here a year sorting that out myself. Thank you both.
Reply all
Reply to author
Forward
0 new messages