Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

delete / replace multiple lines between two keywords

$
0
0
Hi all,
I have a TXT-File with the content

Quote

file start
[xbeginx]
a
b
c
d
[xendx]
file stop

now I want to replace the content between xbeginx and xendx to make the TXT-File looks like

Quote

[xbeginx]
clean
[xendx]


my code doesnt work :( it seems it doesnt work on multiple lines....
[ autoit ]      
$sFile = "source.txt" $sText = FileRead($sFile,FileGetSize($sFile)) $aFound = _StringBetween($sText,"[xbeginx]","[xendx]") $sText = StringReplace($sText, "$aFound", "clean") $sFileNew = "result.txt" FileWrite($sFileNew,$sText)
can you help me?
thanks

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>