If I understand what you’re saying, you have a document with contents that
looks like this:
Line 1
Line 2
Line 3
This is Line 4
Etc.
If that’s so, this AppleScript should do it:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "BBEdit"
set theDocument to document 1
set theContent to contents of theDocument
set theText to text of theContent
set theParagraphs to every paragraph of theText
repeat with aParagraph in theParagraphs
set myNewDocument to make new document
set contents of myNewDocument to text of aParagraph
end repeat
end tell
It’s possible to make this a shorter script but written this way it’s easier to
understand.
c
> On Dec 17, 2020, at 6:07 AM, Gabriel <[email protected]> wrote:
>
> Hi,
> I just discovered BBEdit.
> I'm trying to do something about it:
> From a text document that contains n lines, select the first whole line, copy
> it into a new document, then the next one, until the end of the document (if
> I have 50 lines, I would have 50 new text files).
> I started to explore the possibilities of "grep", with these commands:
> ^.*
> But I can't get the selection to stop at the end of the line, despite many
> tries.
> (I'd like to point out that I don't know anything about these code systems!)
> Ideally I'd like to be able to save these documents with the content of the
> line itself as filename, but let's say it's a second step (and I don't even
> know if it's possible).
> Thanks for the help!
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "[email protected]"
> rather than posting here. Follow @bbedit on Twitter:
> <https://twitter.com/bbedit <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 [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/77232728-9b03-48d1-9988-74fc67d37005n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/bbedit/77232728-9b03-48d1-9988-74fc67d37005n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/2859A09D-EC52-4ADD-85E4-4E50371E6A94%40christianboyce.com.