I received a document which, essentially is a document of song lyrics.
However, they were typed in at random, as they were received. I now want to
sort the songs by song title and can't figure a way to do this. The format
is the following:
The song title, the artist, the lyrics. Each line is essentially a new
paragraph so I cannot sort by paragraph. I need some way of marking the
beginning and the ending of each song, having the contents between these
two marks recognised as a unit, and then sorting these units. Does anyone
have any ideas, without having to select each song, cutting it and then
pasting it in its correct position alphabetically
How many songs?
Steve
Pat Brown wrote:
> I received a document which, essentially is a document of song lyrics.
> However, they were typed in at random, as they were received. I now want to
> sort the songs by song title and can't figure a way to do this. The format
> is the following:
> The song title, the artist, the lyrics. Each line is essentially a new
> paragraph so I cannot sort by paragraph. I need some way of marking the
> beginning and the ending of each song, having the contents between these
> two marks recognised as a unit, and then sorting these units. Does anyone
> have any ideas, without having to select each song, cutting it and then
> pasting it in its correct position alphabetically
>
Here is a recipe that could help you, but it requires the Alternative Searching extension (aka Alternative Find & Replace)
1. Choose two characters that do not appear in your text. I chose # an §.
2. Mark every song title, except the first one, with # at the beginning of the line.
3. With Alt. Find & replace:
Search For: \p
Replace: §
Check "regular expressions" box
Replace all
4. With Alt. Find & Replace:
Search for: §#
Replace \p
("regular expressions" box still checked)
5. Select all text and then Tools > Sort.
6. With Alt. Find & Replace:
Search for: §
Replace \p
("regular expressions" box still checked)
As far as I know, steps 4 and 6 cannot be done with the regular find and replace as you can't specify a paragraph mark in the replace. At least i don't know how to.
Piet van Oostrum wrote:
> As far as I know, steps 4 and 6 cannot be done with the regular find and replace as you can't specify a paragraph mark in the replace. At least i don't know how to.
Well, in the meantime I found that \n in the Replace field with the regular Find and Replace represents a paragraph break. In the Search For field $ should be used. The recipe with the regular Find and Replace then becomes:
(all Find/replace with "Regular expressions"" ticked):
1. Choose two characters that do not appear in your text. I chose # an §.
2. Mark every song title, except the first one, with # at the beginning of the line.
3. Find & replace:
Search For: $
Replace With: §
Replace all
4. Find & Replace:
Search for: §#
Replace With: \n
5. Select all text and then Tools > Sort.
6. Find & Replace:
Search for: §
Replace with: \n
I've got a thought of what might work, but I'd need to see some of the data first.
Do you have any way of providing a portion of the doc for everyone to view?