BasementDweller Posted February 1, 2023 Posted February 1, 2023 I've searched the forum and haven't found anything that I thought would help. And I'm not good at this... I have two text files that I want to concatenate. And I want to write the concatenation result to a text file. Both files have pipe-delimited rows that look similar to this: 22|32566|john|doe|10|john.doe@email.org. The number of rows in each file changes every day. This is the concatenation portion of my script (some of the includes are used in other parts of the script that aren't shown here): #include <INet.au3> #include <Array.au3> #include <File.au3> #include <Date.au3> #include <CSV.au3> #include <String.au3> #include <SFTPEx.au3> $path = @ScriptDir&"\" $aTextFileA=_ParseCSV($path&"TextFileA.txt",'|') $aTextFileB=_ParseCSV($path&"TextFileB.txt",'|') _ArrayConcatenate ($aTextFileA, $aTextFileB) _writecsv("TextFileC.txt", $aTextFileA, '|' ) I'd like TextFileC.txt to be written with rows that look similar to this: 22|32566|john|doe|10|john.doe@email.org. But what gets written is this: "22"|"32566"|"john"|"doe"|"10"|"john.doe@email.net"|"" Can you please show me how to write a TextFileC.txt file that doesn't contain quotation marks and a trailing pipe symbol? Thank you.
Developers Jos Posted February 1, 2023 Developers Posted February 1, 2023 Why not simply read both files and write them into the output file? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Danp2 Posted February 1, 2023 Posted February 1, 2023 Have you tried something like this, which eliminates all the CSV parsing? $aTextFileA=FileReadToArray($path&"TextFileA.txt") $aTextFileB=FileReadToArray($path&"TextFileB.txt") _ArrayConcatenate ($aTextFileA, $aTextFileB) _FileWriteFromArray("TextFileC.txt", $aTextFileA) Latest Webdriver UDF Release Webdriver Wiki FAQs
BasementDweller Posted February 1, 2023 Author Posted February 1, 2023 Thank you Jos and Danp2 for your quick replies. Danp2 -- Your suggestion is exactly what I needed. Thank you very much.
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