I have a shell script which basically runs every day to create a list of files from previous day and count the number of requests inside the file.
For the purpose of creating list of files I use the find command as below
find ${Search_Path} -type f -newer ./start-time \! -newer ./end-time |egrep '\.5500\.|\.5000\.' >IncomBQR.txt
In the past I faced a problem that it seems to be outputting multiple row
So I tried to fix it by creating a uniq list as below.
sort -u IncomBQR.txt>IncomBQR1.txt
cat IncomBQR1.txt>IncomBQR.txt
rm -f IncomBQR1.txt
But after a few month that also failed. Could you please help me debug the problem?
When It runs the command I get is
${Search_Path}/file1
${Search_Path}/file1
where as I should be getting only one row for "file1"
However the strange thing is that when I manually run it finds only 1 row.
/gtpfssharepath/ORGXXXX/processed/billRequest/myrquest-20160312.DATin my output listing it looks like this/gtpfssharepath/ORGXXXX/processed/billRequest/myrquest-20160312.DAT |35 /gtpfssharepath/ORGXXXX/processed/billRequest/myrquest-20160312.DAT |35I am wondering the problem might be due GPFS file system ?IncomBQR.txtand add grep-results of that file. Try redirecting the find output to a place in another directory tree like/tmp/IncomBQR.txt.findonly returns the file once (as it should) then there's a problem with your script. While post-processing the file might patch over the problem, it's not fixing it.