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

<< < (6/9) > >>

Ath:
Well, an answer still missing is what to do if there is only one (1) phrase on a line. With current scripts the entire line will be deleted.

Ath:
I was revising because I don't like forget the thread.
-Contro (March 04, 2017, 05:14 AM)
--- End quote ---
The forum has a 'Mark topic' button with several options to keep topics in sight... :)

Please reply to my previous answer :up:

Contro:
Sorry Ath.
I have to revise this post.
It's too late here now. I must be in bed and rest. I will revise !!!!!!

skrommel:
 :) How about this one?

Fill inn source and target and save the script as Parts.ahk. Download and install Autohotkey to run the script.

Skrommel


--- ---source=Source.txt
target=Target.txt

#NoEnv
#SingleInstance,Force
SetBatchLines,-1

string:=""
FileRead,lines,%source%
Loop,Parse,lines,`n                                ; Split by line break
{
  StringSplit,part_,A_LoopField,.                  ; Split by period
  If part_0<3                                      ; 1 part
    line:=A_LoopField
  Else
    StringReplace,line,A_LoopField,%part_1%.,      ; Remove part 1
  line=%line%                                      ; Remove trailing space
  string.=line "`n"                                ; Add line break
}
FileDelete,%target%
FileAppend,%string%,%target%

Contro:
 :-*
Well, an answer still missing is what to do if there is only one (1) phrase on a line. With current scripts the entire line will be deleted.
-Ath (March 04, 2017, 06:02 AM)
--- End quote ---
I am going to try the script Skrommel
Where are you Ath ?
 ;D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version