ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Sort (and split) text by user-added (tag) strings in front of paragraphs

(1/1)

tmpusr:
The idea is to be able to gather paragraphs that have the same kind of content together for further editing.

Example: you've collected paragraphs of text dealing with several different topics into a single file, but they are in random order. To get them in order, you read each paragraph just enough to determine what it's about and add a tag. After you're done, you run this program and you've got all the tagged ones neatly together, in the same order as they were in the original text.

Huge messy text file:

Something about zeros 1.
Something about ones 1.
Something about ones 2.

Something about zeros 2.
Something about zeros 3.


Something about ones 3.

Something about zeros 4.


The user manually adds a tag to the beginning of each paragraph - to make it easy using perhaps some auto string expander, typing e.g. zzero, oone, or +z, +o:

[Zero] Something about zeros 1.
[One] Something about ones 1.
[One] Something about ones 2.

[Zero] Something about zeros 2.
[Zero] Something about zeros 3.


[One] Something about ones 3.

[Zero] Something about zeros 4.


The software sorts the paragraphs so that all paragraphs that have the same tag are together. It can export them into files that have the tag as a name (optionally without the special characters, like []):

[Zero] Something about zeros 1.
[Zero] Something about zeros 2.
[Zero] Something about zeros 3.
[Zero] Something about zeros 4.

[One] Something about ones 1.
[One] Something about ones 2.
[One] Something about ones 3.


(Notice the zeros were first, because the first occurrence of a tag was a zero.)


Options:

The tag as a subtitle before the paragraphs with optionally one or two empty lines above it and one, two or none below.
Add empty line between paragraphs.
Don't remove the tags from the result.
Sort tags alphabetically (the ones would be first).
The tag can be anywhere within the paragraph.


The tags could of course be anything, like -z and -o. The software determines it's a tag if two instances of the same string appear in front of paragraphs.


MilesAhead:
I didn't use vi much when I was messing around with Linux, but I tried it enough to be surprised if vim wouldn't be able to do something like this.  The paragraph manipulation is much more powerful than most editors we're used to on Windows.  And I believe it's a freebie.

tmpusr:
How about making it easier:

If the first string of the paragraph is equal to any of the lines in a text file (containing the tags), append the paragraph and optionally the following paragraphs until the next tag to a file by that name and optionally remove the appended text from the original file.

A snack, eh?

Navigation

[0] Message Index

Go to full version