Using Nested loops in Unix
Hello Gurus,
Hope you are having a good day..
I am trying to built some code with nested loops in unix.
Here is some background...
I have a directory , wherein everyday 2 types of files are generated ..lets say by the name 'date'*3.log and 'date'*4.log
These files have a unique layout. The command is run once everyday to generate a file everyday. What I do is a compare between the file generated today and the one generated yesterday using diff..nd something like below
diff 1.log 2.log | tail -n +2 | head -n -4 |awk '{print $2,$3,$4,$5,$6}' > 3.log
to bring it to a specific format.. and further passing it to a perl script to format it further and finally doing a grep to remove unwanted entities.
Need your help with the piece of code which I been trying to make it to work. I am trying to build 2 loops with i and j variables to help generate the final log files in the required format.
Attaching the script as well. Pls advise.
Thanks
Dev
Last edited by debumail186; 11-13-2014 at 07:14 PM.
|