Kerberuz Posted April 20, 2005 Posted April 20, 2005 I need to merge two files based on a common number in each file. The problem I'm having is the when I read 2 files into arrays the first array read is no longer valid. Does anyone know a work around for this?Example:#include <file.au3> #include <array.au3> Dim $aFile, $aMerged _FileReadToArray("CC24-Other2.txt",$aFile) _FileReadToArray("RAA P24 Data 3.txt",$aMerged) _ArrayDisplay($aMerged, "") _ArrayDisplay($aFile, "")Thanks in advance for your replies Kerby
zcoacoaz Posted April 20, 2005 Posted April 20, 2005 What do you mean "no longer valid." ? When i read two files to an array the same way you did it works perfectly. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
Ejoc Posted April 21, 2005 Posted April 21, 2005 Worked for me: CC24-Other2.txt: I'm that CC24 file RAA P24 Data 3.txt: I'm That RAA file Script: #include <file.au3> #include <array.au3> Dim $aFile, $aMerged _FileReadToArray("CC24-Other2.txt",$aFile) _FileReadToArray("RAA P24 Data 3.txt",$aMerged) _ArrayDisplay($aMerged, "") _ArrayDisplay($aFile, "") Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Kerberuz Posted April 21, 2005 Author Posted April 21, 2005 That's very curious. I have a work around. So it's no big deal, thanks for your replies. I still have a little cleanup to do, but I'm done with what I needed help on. Again thanks for your replies. #include <file.au3> #include <array.au3> Dim $aMerged, $Merge _FileReadToArray("RAA P24 Data 3.txt",$aMerged) $CountLines = _FileCountLines ("CC24-Other2.txt") $file = FileOpen ( "RAA_P24_Data_4.txt", 2) FileWrite($file, "Case,Date,Problem,Party,Age,Trimester (60),Out (59),See Any Part (113),Contractions (125),Delivery (61),Pain Interval (127),SERIOUS Bleed (184),High Risk (98),Det Code,Other,Other (edited for sorting),Other (edited) 2nd condition" & @CRLF) For $i = 1 to $aMerged[0] - 1 Step 1 $Merge = 0 For $x = 1 to $CountLines Step 1 If StringLeft( FileReadLine ( "CC24-Other2.txt" ,$x ), 7) = StringLeft($aMerged[$i], 7) Then $Merge = 1 $aSplit = StringSplit(FileReadLine ( "CC24-Other2.txt" ,$x ), ",") FileWrite($file, StringStripWS($aMerged[$i], 2 ) & "," & $aSplit[3] & "," & $aSplit[4] & "," & $aSplit[5] & @CRLF ) EndIf Next If $Merge = 0 Then FileWrite($file, StringStripWS($aMerged[$i], 2 ) & ",,," & @CRLF ) EndIf Next Kerby
Kerberuz Posted April 21, 2005 Author Posted April 21, 2005 After closing and reopening SciTE it worked just fine... Kerby
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