Sign in to follow this  
Followers 0
bf2forlife

Typing "asd" in start of every line in .txt file

7 posts in this topic

So how to type "asd" in start of every line in .txt file?

Share this post


Link to post
Share on other sites



I dont know where to start, only thing that pops on my mind that u could click in start of each line, but that would be slow and hard

Share this post


Link to post
Share on other sites

I'm feeling generous today...

#Include <File.au3>
#include <Array.au3>
Global $aLines, $sNewLines, $sPath = "./Test.txt"
If Not FileExists($sPath) Then FileWrite($sPath, "line1" & @CRLF & "Line2" & @CRLF & "line3")
_FileReadToArray($sPath, $aLines)
For $i = 1 to $aLines[0]
    $sNewLines &= "asd" & $aLines[$i] & @CRLF
Next
FileDelete($sPath)
Sleep(200)
FileWrite($sPath, $sNewLines)

Share this post


Link to post
Share on other sites

thanks

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I'm feeling generous today...

#Include <File.au3>
#include <Array.au3>
Global $aLines, $sNewLines, $sPath = "./Test.txt"
If Not FileExists($sPath) Then FileWrite($sPath, "line1" & @CRLF & "Line2" & @CRLF & "line3")
_FileReadToArray($sPath, $aLines)
For $i = 1 to $aLines[0]
    $sNewLines &= "asd" & $aLines[$i] & @CRLF
Next
FileDelete($sPath)
Sleep(200)
FileWrite($sPath, $sNewLines)oÝ÷ Ûú®¢×ßÙeër¢ìاÚ.±ä^LiÉëOjëh×6$s_string = "I am a line of text in a text file" & @CRLF & _
    "I am another line of text in a text file" & @CRLF & _
    "I am the last line of text in a text file"

$s_string = "asd" & $s_string
$s_new_string = StringRegExpReplace($s_string, "\n", "\1asd")
ConsoleWrite($s_new_string & @CRLF)
Edited by SmOke_N
damn code tags

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

One of these days Smoke :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0