NoizeBit Posted September 6, 2015 Posted September 6, 2015 Hi again!Looking for the easiest/shortest method to read all lines of a file except for the first one (csv header):FileRead($sSourceCSV)Thanks in advance!
Celtic88 Posted September 6, 2015 Posted September 6, 2015 #include <MsgBoxConstants.au3> Global $Skipline = 0 ;0==> first line Example() Func Example() ; Read the current script file into an array using the filepath. Local $aArray = FileReadToArray(@ScriptFullPath) If @error Then MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file. Else Local $temprf For $i = 0 To UBound($aArray) - 1 ; Loop through the array. If $Skipline = $i Then ContinueLoop $temprf &= $aArray[$i] Next EndIf MsgBox(0, 0, $temprf) EndFunc ;==>Example NoizeBit 1
NoizeBit Posted September 6, 2015 Author Posted September 6, 2015 #include <MsgBoxConstants.au3> Global $Skipline = 0 ;0==> first line Example() Func Example() ; Read the current script file into an array using the filepath. Local $aArray = FileReadToArray(@ScriptFullPath) If @error Then MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file. Else Local $temprf For $i = 0 To UBound($aArray) - 1 ; Loop through the array. If $Skipline = $i Then ContinueLoop $temprf &= $aArray[$i] Next EndIf MsgBox(0, 0, $temprf) EndFunc ;==>Example Awesome, just what I was looking for. Thanks a bunch, Celtic88
NoizeBit Posted September 6, 2015 Author Posted September 6, 2015 Awesome, just what I was looking for. Thanks a bunch, Celtic88 One more thing: how could I add line breaks (@CRLF) after every line to maintain the original format as result?Right now the result is one really long line
Danyfirex Posted September 6, 2015 Posted September 6, 2015 add & @crlf Saludos NoizeBit 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
mikell Posted September 6, 2015 Posted September 6, 2015 ; line 1 ; line 2 $res = StringRegExpReplace(FileRead(@ScriptFullPath), '^.*?\R', "") Msgbox(0,"", $res) NoizeBit 1
NoizeBit Posted September 6, 2015 Author Posted September 6, 2015 ; line 1 ; line 2 $res = StringRegExpReplace(FileRead(@ScriptFullPath), '^.*?\R', "") Msgbox(0,"", $res)I need to get familiarized with regexp, I know, I know
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