In above files, file1 is Aggr_New_06_19_2013_1944.txt and file2 is Aggr_New_06_20_2013_1956.txt, previous file should compare with current file(newfile) and difference or new records in file2 should get output to file3.
GNU: Yes, Date command will work in our linux server, but this comparison will do whenever we require like monthly 15 or 20days will run, not daily, requirement is always previous file should compare with new file and get difference output to file3.
Thanks for your reply Vidyadhar..!!
Its working if we have y'day and today files, the files executes in windows only some times, like continuous 10days then after that again 20th day...so in this case, 10th day file wil be like...
In above case, previous file is 10th day file, new file is 20th date file, script is not working in this case...hope you can understand the requirement.
its depends on requirement when we get files, we can't hardcode any particular date, again it will be like manual as example below...
Code:
Day1
Aggr_New_06_10_2013_1944.txt
Aggr_New_06_20_2013_1956.txt
Day2
Aggr_New_06_20_2013_1944.txt
Aggr_New_06_21_2013_1956.txt
next run
Aggr_New_06_21_2013_1944.txt
Aggr_New_06_25_2013_1956.txt
its depends on requirement when we get files, we can't hardcode any particular date, again it will be like manual as example below...
Code:
Day1
Aggr_New_06_10_2013_1944.txt
Aggr_New_06_20_2013_1956.txt
Day2
Aggr_New_06_20_2013_1944.txt
Aggr_New_06_21_2013_1956.txt
next run
Aggr_New_06_21_2013_1944.txt
Aggr_New_06_25_2013_1956.txt
It may occur like this...
If your input file names are as described above and you want them sorted by year, month, day, and time; one of the following should work for you.
When there are just two files in the current directory and both files are from the same year, a simple:
Code:
echo *
will give you the two filenames to be processed in the correct order. If the files may be from different years, try:
Code:
ls -f | sort -t_ -k 5,5 -k 3,4 -k6,6
If your output file is also in the same directory (and has a name that doesn't start with Aggr, you can use:
Code:
ls -f Aggr* | sort -t_ -k 5,5 -k 3,4 -k6,6
If there are a bunch of these files in the directory and you just want the last two, you can use:
Hi all,
I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like:
<date1>|<data1>|<url1>|<result1>
<date2>|<data2>|<url2>|<result2>
<date3>|<data3>|<url3>|<result3>
<date4>|<data4>|<url4>|<result4>
What I... (3 Replies)
Hello,
I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be:
SRVXPAPI001 ERRO JUN24 07:28:34 1775
REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F
... (8 Replies)
Hi everybody,
First I apologize if my question seems demasiad you silly, but it really took 4 days struggling with this, I looked at books, forums ... And Also ask help to a friend that is software developer and he told me that it is a bad idea do it by perl... but this is my problem.
I moved to... (8 Replies)
Hi,
i have file which contains data as below(Only sample shown, it may contain more data similar to the one shown here)
i need to read this file line by line and generate an output file like the one below
i.e based on N value the number of MSISDNs will vary, if N=1 then the following... (14 Replies)
So, I want to read line-by-line a text file with unknown number of files....
So:
a=1
b=1
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
done
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
Hi,
I am trying to find an alternative way to do tkdiff. In tkdiff the gui compares each line and highlights only the differences.
for eg:
John works at McDonalds s(test)
He was playing guitar tywejk
John works in McDonalds 9908
He was playing guitar
I am... (1 Reply)
File 1
<html>ta da....unique file name I want to give file=>343...</html>
<html>da ta 234 </html>
<html>pa da 542 </html>
and so on...
File 2
343
234
542
and so on, each line in File 1 one also corresponds with each line in File 2
I have tried several grep, sed, while .. read, do,... (4 Replies)
i have two files and i want to compare these two
it shoud print those lines which are not in 2nd file
a.txt
1236,AB,0
2345,CD,1
5679,EF,1
9123,AA,1
9223,AA,0
b.txt
1234,AB,0
2345,CD,1
5678,EF,1
9123,AA,0
o/p
1236,AB,0
5679,EF,1
9123,AA,1
9223,AA,0 (6 Replies)