cwstad2
asked on
Powershell appending files
Hi all i have a script that i will be running several times and combining into a single file.
Is there a way to append only new entries into the file as currently its adding all entries which essentially become duplictaes
thanks
Is there a way to append only new entries into the file as currently its adding all entries which essentially become duplictaes
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It depends on what type of data/objects you are dealing with. Normally, I would say to bring the keys of your target collection into a hash table and then check to see whether new item keys already exist in the hash table before adding/appending.
ASKER
Hi Aikimark, how would that be possible
thanks
thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As said, that requires that you can isolate an unique key element to determine if each entry is new or not. You need to have knowledge about the meaning and layout of the output. E.g. if you want to have a scan over PCs for reachability, and only need to know whether they have been reachable at least once out of n tests, that would make up a list (PC, reachable, last fail or first success time stamp), where you change existing records (or not) and add non-exisiting ones.
ASKER
Thought it was worth a try
Thanks
Thanks