Link to home
Start Free TrialLog in
Avatar of cwstad2
cwstad2Flag for United Kingdom of Great Britain and Northern Ireland

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
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of cwstad2

ASKER

Hi Aikimark, how would that be possible

thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of cwstad2

ASKER

Thought it was worth a try

Thanks