Hello
Below is my requirement
I have 3 files A1.txt , A2.txt and A3.txt . A2 is dynamically generating file
I want the merge of A1,A2 and A3 in A2.txt
Could you please help?
Hello
Below is my requirement
I have 3 files A1.txt , A2.txt and A3.txt . A2 is dynamically generating file
I want the merge of A1,A2 and A3 in A2.txt
Could you please help?
how do you want to merge?? Just appending the contents? in that case. try cat A[1-3].txt >> A2
Try to concatenate to new file and if succesful replace the old file with the new one, for example:
cat A[1-3].txt > A0.txt && mv A0.txt A2.txt
Is there a suitable date/time as part of the data? If it is YYYYMMDDHHMMSS format, then you can:-
sort -n A[1-3].txt>A0.txt && mv A0.txt A2.txt
Of course, if you repeat this, you will start getting duplicate data in A2.txt unless A1.txt & A3.txt are cleared down.
Of course, you need to be sure that no new data is being written to them between when you read them and when you clear them. Perhaps this would help, but add some error checking:-
mv A1.txt A1T.txt
mv A2.txt A2T.txt
mv A3.txt A3T.txt
sort -n A[1-3]T.txt > A2.txt
rm A[1-3]T.txt
Robin