Sign in to follow this  
Followers 0
face

merge same name text files with add only option

4 posts in this topic

i want to merge folder1/textfile.txt with folder2/textfile1.txt with an add/insert only lines option from folder2/textfile1.txt to folder1/textfile.txt

it shouldn't replace, delete or edit existing textfile1 text lines

Share this post


Link to post
Share on other sites



FileReadToArray

FileWrite

Not sure your code and or explanation helps more than that offering.


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

As SmOke_N said, and without any code, all we can offer, is you read about those commands in the Help file.

If you struggle with the concept of arrays, then also look at FileOpen, FileRead and the switches (parameters) for those and FileWrite. Those switches are vitally important to avoid overwriting.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

I made this (I couldn't test it so I don't know if it works at all) but I got stuck on what you mean by merge or merge by line. Do you know what line you want to merge or are you looking for a GUI that will allow you to enter that data and maybe show you the data and the line so you can tell the script what lines from file 2 to merge?

#include <array.au3>

GLobal $File1Location = (@ScriptDir & "\folder1\textfile1.txt")
Global $File2Location = (@ScriptDir & "\folder2\testfile1.txt");<- is the 1 in the file name a typo on your part in your original post?
Global $aArray1[0];file 1 contents
Global $aArray2[0];file 2 contents

$File1Contents = _FileReadToArray($File1Location,$aArray1,"",@CRLF)
$File2Contents = _FileReadToArray($File2Location,$aArray2,"",@CRLF)

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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