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

[Solved] Manipulate lines in a txt file

<< < (3/9) > >>

wraith808:
When you say delete the first phrase of each line... in your line 1, what part would you delete?

Contro:
Here's a '2-step' Notepad++ solution:

Settings for Replace dialog (Ctrl-H):
Search mode: Regular expression
. matches newline: Off (=not checked)

Step 1: (Remove all first phrases)

--- ---Find what: [^\.]*?\.(.*)
Replace with: \1\nPress Replace all button

Step 2: (Replace all remaining phrases by the phrase and a new-line, removing any white-space in front of a phrase)

--- ---Find what: \s*([^\.]*?\.)
Replace with: \1\nPress Replace all button
Done :D

Remember: It replaces the file-contents, so either work on a copy or use Save as... if the original file needs to be preserved.

PS: Tested using Notepad++ 7.2.2

NB: please report how it's working for your file(s) so the thread can be moved to Resolved when satisfactory.

-Ath (February 17, 2017, 01:39 PM)
--- End quote ---

I am a user of pspad several years ago. First with notepad++. Both are excelent programs.
I tried to use , for the ocassion, only notepad++ to follow Ath instructions.

The two steps procedure works like a charm.

I had installed the notepad++ spanish version and use very little. Only when i have many files opened, just because I am more used to pspad.

I haven't discover the similar option with pspad. In the spanish version the option .matches newline correspond to .se ajusta a linea (unmarked)

Following the very good instructions from Ath I obtain the first phrase deleted and the beginning of the next phrase seperated by one space from the left.
So I only have to trim the left and delete any empty line after deleting the first phrase of each line.
This is very easy with pspad, and I suppose too with notepad++

Then first step wonderful with Notepad++

Then apply the second step to the rest of lines.

The second step works wonderfully. This time without need to trim from the left.


During Ath wonderful intervention I was searching : text mechanic, text crawler and a lot more. But the simplicity of notepad++ is the final winner.

The problem - my problem - is totally solved.

Best Regards
 :-* :tellme: :tellme:


Contro:
When you say delete the first phrase of each line... in your line 1, what part would you delete?
-wraith808 (February 17, 2017, 05:53 PM)
--- End quote ---

By example :

Phrase 1. Phrase2.
Phrase1 .Phrase2.
Phrase1. Phrase 2.

The result is Phrase2. or Phrase 2.

Delete Phrase 1. Delete the period. Delete the space beginning the next phrase.
Until the next first letter of the second phrase.

 :-*

Contro:
BTW . I like homeopathy as energetic medicine.
I don't understand very well why is a pseudo science.
Perhaps by economic interests of the official medicine ?

What do you think ?

Ejem. I am trying to find an homeopathic remedy for my lack of memory. Since is an atoxic medicine is no risk.

Recently , in my first mountain excursion to lose weight , I have an accident and received a lot of medicines to cure. Anti inflammatory, analgesics, ..... . But I decided use ice and manage the ache all over.

So I got an influeza by the cold  ;D and rest a lot more of hours because of the pain. But discover that I lose more kilograms according to the number of hours i rest.

So my real medicine is rest and dream.

 :-*

Ath:
So I only have to trim the left and delete any empty line after deleting the first phrase of each line.
This is very easy with pspad, and I suppose too with notepad++
-Contro (February 17, 2017, 06:51 PM)
--- End quote ---
Hm, you didn't say you wanted to store the intermediate result too.
A small addition to step 1 would fix that:
Updated step 1:
Step 1: (Remove all first phrases, trim any leading white-space from the remaining part)

--- ---Find what: [^\.]*?\.\s*(.*)
Replace with: \1\n
Press Replace all button

I updated the original post for this Notepad++ solution.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version