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

(1/9) > >>

Contro:
I have a txt file with many lines.
Each line may have several points.
Phrase 1. Phrase 2.Phrase3. Phrase 4 ....... until ten or more

I would like create from each line of the original file a line with each phrase, except phrase 1 that is deleted.

I would like a simple application to do this with regular expressions or similar. Or an autohotkey script for this purpose.

Split a line by the points and delete the first phrase (until the first point....)

Do you know a simple environment to do this ?

Best Regards

Ath:
Showing some actual data might help to provide the best solution. Knowing the separator between the phrases is crucial.

Simple: Do it by hand in a text editor. (Yes, that's time consuming, but simple)
Less simple: use sed or awk (both of these Unix command-line tools are available in a Windows version, or can be run using Cygwin)

Ath:
awk one-liner to get your original request, assuming period ('.') as a separator, ignoring the first phrase on each sentence, removing leading whitespace from each column and restoring the period after each phrase:

--- ---awk -F'.' '{for(i=2;i<=NF;i++) {$i=gensub(/^[ \t]*|[ \t]*$/, "","g",$i);if($i!="") print$i"."}}'
add this to process input.file to output.file (output.file is created/overwritten):

--- ---input.file >output.file

anandcoral:
Hi Contro,

You can try search and replace in text editor like Notepad++ to get what you want.

You can also try online line break http://textmechanic.com/text-tools/basic-text-tools/addremove-line-breaks/, it has many text manipulation options.

There is another text manipulation website and may help you http://nimbletext.com/HowTo/ManipulateText

Regards,

Anand

Contro:
Hi Contro,

You can try search and replace in text editor like Notepad++ to get what you want.

You can also try online line break http://textmechanic.com/text-tools/basic-text-tools/addremove-line-breaks/, it has many text manipulation options.

There is another text manipulation website and may help you http://nimbletext.com/HowTo/ManipulateText

Regards,

Anand


-anandcoral (February 17, 2017, 03:45 AM)
--- End quote ---
I have tried with pspad with no good result.
I doubt notepad++ may help.

trying the rest.
the last one seems a paid option

Navigation

[0] Message Index

[#] Next page

Go to full version