i need a script that can add a suffix to every line of every text file in a folder
does anyone have an example i can work with?
please help if possible
add suffix to the end of every line of every text file
Re: add suffix to the end of every line of every text file
example
( instead delete original file can also write to a new file )
( instead delete original file can also write to a new file )
Code: Select all
;- reads textfiles and add "_ADD" at end of line
setworkingdir,%a_scriptdir%
Extensions:= "txt,bas,bat" ;- some extensions
PRESELECT =%a_desktop% ;- search from here
FileSelectFolder,MF,%PRESELECT%
if MF=
return
setworkingdir,%MF%
Loop, %mf%\*.*, 0, 1
{
If A_LoopFileExt in %Extensions%
{
e=
y:=A_LoopFileFullPath
FileRead,aa,%y%
Loop, parse,aa, `n, `r
{
x := a_loopfield
if (x="")
continue
e .= x . "_ADD`r`n"
}
;Filedelete,%y% ;- instead delete can also write to a new file
;Fileappend,%e%,%y%
new=%dir%\%name_no_ext%_NEW.%ext%
;msgbox,%new%
Fileappend,%e%,%new%
e=
}
}
run,%mf%
return
Re: add suffix to the end of every line of every text file
For reference, TF has a such a function also to do so in specific lines, https://github.com/hi5/TF#TF_InsertSuffix
Who is online
Users browsing this forum: No registered users and 144 guests