Please help me to write the following script. 1) Input files will be in Test directory. (Test/YYYY/MM) folders (Ex: 1) 2010/ 01 2) 2011/05) The file name will be Testfile1_6676543218_Axxxxxxyyyyyzzzzzzzzzzzzzzzzzz.pdf.gz 2) The compare file will be in /tmp directory. (/tmp/comparefile.txt). The file will have list of 6 digit numbers. Ex: (001234 015678 045679) 3) The batch has to compare 6 digit numbers in the compare file and 6 digit numbers in PDF file (xxxxxx - position 23 - 28) in the Test directory folders(Current month - Previous months). If it matches, then copy the pdf file to the new folder.
1) Conditions: It has to look for (Current month - Previous months) folder. Previous month should read from the property file. It can be either (01 ....12 months)
Ex: if Current month - 01 2011 and Previous month - 06 2010 then batch has to look since Aug 2010 to Jan 2011 ) folder
The compare file will have around 200 store numbers.
Ex: (001345
013467
027890
011456)
The pdf files will be under Test/2010/01 --> Testfile1_6676543218_A0013457899000232323232323232323232.pdf.gz
Testfile1_6676543218_A0013447899000232323232323232323232.pdf.gz
Testfile1_6676543218_A0134677899000232323232323232323232.pdf.gz
if current month is 01 and previous month is 06 ..then batch has to look for all the folders since Aug(2010/05 folder to 2011/01 folder).
Hope it clears. if 001345 matches(position 23 - 28) any of the above folder , then it should copy to the new folder(sample folder)
My proposed solution: Usage:
If comparefile is not provided or is set to "-", then the list will be read from standard input. Lines beginning with "#" are ignored.
Caveat emptor
While I have done my best to test this, please make sure you understand what is going on before you run this in production. At a minimum, change:
to
to see what would be done.
Notes
Let me know if you have any questions.
I would appreciate knowing if there are any kshisms I did not take advantage of.
i have two csv files (rates.csv, reference.csv) as below.
rates.csv contains Code, respective Zone details
rates.csv
----------
23,38Nhava
45,37NEWYORK
89,SHILANG
71,ROBACCA
reference.csv contains all Zone details
reference.csv
-------------
37Newyork
robacca
38Nhava... (5 Replies)
Hi,
i have a file which contains names of persons and date as below.
peter 27-mar
Vicky 08-sep
Saryu 03-jan
venki 14-dec
.....
...
can someone plz provide a script logic, which returns the Name of the person whose date is matching with current date. (5 Replies)