dancer58 Posted December 31, 2007 Posted December 31, 2007 I have text (.csv) file I need to number. It has appr. 1000 lines and over 60% have the same name. There is one thing in common and that is every line has COE in caps. COE is not in the same place in each line. I need to number each line starting with 1 and incrementing by 1 for each line. I need the numbering to be at the end of COE. COE1 COE2 ect. Does anyone have a program that I can use/modify to do this Thanks Harold
James Posted December 31, 2007 Posted December 31, 2007 Look at the For Next loop Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
randallc Posted December 31, 2007 Posted December 31, 2007 Hi,untested, modify; ; filereadd.au3 #include <file.au3> Dim $aRecords If Not _FileReadToArray("error.log", $aRecords) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 To UBound($aRecords)-1 $aRecords[$x] = StringReplace($aRecords[$x], "COE", "COE" & $x) Next FileDelete("error.log") _FileWriteFromArray("error.log",$aRecords,1)Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
dancer58 Posted January 1, 2008 Author Posted January 1, 2008 (edited) Hi,untested, modify; ; filereadd.au3 #include <file.au3> Dim $aRecords If Not _FileReadToArray("error.log", $aRecords) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 To UBound($aRecords)-1 $aRecords[$x] = StringReplace($aRecords[$x], "COE", "COE" & $x) Next FileDelete("error.log") _FileWriteFromArray("error.log",$aRecords,1)Best, Randall Thanks_____This did the job #include <file.au3> Dim $aRecords If Not _FileReadToArray("d:\downloads\CorpsofEng.csv",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] ;Msgbox(0,'Record:' & $x, $aRecords[$x]) $aRecords[$x] = StringReplace($aRecords[$x], "COE", "COE" & $x) Next FileDelete("c:\Program Files\AutoIt3\au3 files\CorpsofEng.csv") _FileWriteFromArray("d:\downloads\CorpsofEng.csv",$aRecords,1) Thanks for the input Edited January 1, 2008 by dancer58
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now