Your requirements here (as in your previous three threads on this topic) are confusing and incomplete.
I have no idea how you expect to match a filename to the second (as required by the format strings you are using that specify not only year, month, and day but also hour minute and second) which you then compare to the year, month, day (for the previous 10 days) and the hour, minute, and second at the time at which you run your script. How will you guarantee that you are running your script at exactly 15:03:25 when you are looking for matches for the 1st dates in your filenames and at exactly 11:22:27 when you are looking for matches for the last dates in your filenames?
If your input filename samples:
are correct, and you want to match filenames starting with adb_voda_ with the dates marked in red, and ending with .txt, it would seem that the format you feed into your script should be:
which your code would then convert to the date format string:
and date would then create a pathname matching pattern from that that would match the file(s) you want to select for a given date without a prefix pattern and without asterisks that have cause you problems in all of your previous threads (as well as in this thread).
All of the code you have that is stripping off _s, and Xs and ?s seems to be fighting against matching only the filenames you want to match.
Similarly, if you wanted to match the last date in those files (marked in blue), it would seem that you want the input format string to be:
which your code would then convert to the date format string:
The purpose of those comands are to find the newest file in a directory acvrdind to system date, and it has to be recursively found in each directory.
The problem is that i want to list in a long format every found file, but the commands i use produce unexpected results ,so the output lists in a... (5 Replies)
I would like ot create shell script/ bash to create diffrent files based on a file and parameters list.
Here is the detail example: I have a textfile and four static parameter files (having ‘?'). mainfile.txt has below records (this count may be more than 50)
A200001
A200101
B200001... (9 Replies)
Evening all. I'm having a terrible time with a script I've been working on for a few days now...
Say I have a text file named top10song.tm2, with the following in it:
kernkraft 400
Imagine
i kissed a girl
Thriller
animals
hallelujah
paint it black
psychosocial
Oi to the world... (14 Replies)
I'd like to grep files for key words using korn shell, and compile the actual contents (not just file name) of those files that contain a combination of those grepped key words into one repository file for reference. However, I'm stuck at the combining part. Here's what I have thus far:
egrep... (5 Replies)
counter=0;
while read line;
do ] && let counter=counter+1; done < input_file.txt
echo $counter
The above code is reading a file line by line and checking whether the filenames mentioned in the file exist or not .
At present the o/p is value of counter
I want to echo out the name of... (5 Replies)
I have an issue with a korn shell script that I am writing. The script parses through a configuration file which lists a heap of path/directories for some files which need to be FTP'd. Now the script needs to check whether there are any files which have not been processed and are X minutes old.
... (2 Replies)
Hi All,
I need to list the files based modification time of the files from a directory, I cannot use "ls -t" as there are lot of files, which "ls" command cannot handle. New files will land there daily. So iam looking for an alternative through "find"command.
All suggestions are welcomed.
... (6 Replies)
Hi,
I'm writing a post-upgrade script and I want to find which files don't have read and execute to everyone.
I can run a find . ! -perm, but then I have to use a list of the possible permissions (777,775, 755 etc). Is there a more elegant solution?
Thanks (2 Replies)
Hi,
I have two pipe separated files as below:
head -3 file1.txt
"HD"|"Nov 11 2016 4:08AM"|"0000000018"
"DT"|"240350264"|"56432"
"DT"|"240350264"|"56432"
head -3 file2.txt
"HD"|"Nov 15 2016 2:18AM"|"0000000019"
"DT"|"240350264"|"56432"
"DT"|"240350264"|"56432"
I want to list the... (6 Replies)