Somehow i find that hard to believe. the directory /dev is the directory for devices and everything related to their handling. Nobody in his right mind would put files in there just to work on them.
Are you really, really sure you want to move files around in this sensitive part of a system? Chances are you might crash the system beyond any posibility of repair.
I made the changes you suggested & here is the error log,
Couple of observations i had :
1. It is not fetching the BUS-DATE/SUB_DATE values
2. Can you pls tell what maxdepth do ?
Couple of observations i had :
1. It is not fetching the BUS-DATE/SUB_DATE values
You're right.
But my humble opinion is that it should.
Try to run directly:
What happens?
Quote:
2. Can you pls tell what maxdepth do ?
Option "-maxdepth N", where N>=0 is an integer, tells find to go down in the directory tree for N levels at most. N=1 means: search only in the specified directory, do not search in any subdirectory.
From the man:
Quote:
-maxdepth levels
Descend at most levels (a non-negative integer) levels of directories below the
command line arguments. -maxdepth 0
means only apply the tests and actions to the command line arguments.
How are you ? I tried the following commands. Here is what I found,
ls /devdata/cpmg/tmp/DynamicDateFile.txt #the file is there? File is present
cat /devdata/cpmg/tmp/DynamicDateFile.txt #let's look at its text It showed the dates correctly.
grep BUS_DT /devdata/cpmg/tmp/DynamicDateFile.txt #see whether grep works this time, or what errors it produces grep command gave the correct dates
But, the commands given by you somehow is not taking values from the file, i guess that s the issue. I will work on it today & let you know in-case of any progress.
Pls share your thoughts if you have any.
Thanks,
Freddie
---------- Post updated at 12:06 PM ---------- Previous update was at 12:03 PM ----------
Hello Bakunin,
I am not using the /tmp in my code. I gave it in the post as I didnt want to paste the actual directory (which is pretty lengthy). Thanks for pointing it out & i am sure your observation will help others who might visit this thread.
Thanks
Freddie
---------- Post updated at 12:16 PM ---------- Previous update was at 12:06 PM ----------
Hi Lem,
Adding one more point. While reading about egrep, i didnt find -o function for it. Pls correct me if I am wrong.
grep BUS_DT /devdata/cpmg/tmp/DynamicDateFile.txt #see whether grep works this time, or what errors it produces grep command gave the correct dates
But, the commands given by you somehow is not taking values from the file, i guess that s the issue.
Most probably the next grep is the guilty one:
Let's see if the syntax above works well with your grep, your system and your shell - as it works in mine:
In console:
If it works, the problem in the script is surely the trailing $, so remove it:
If it doesn't work, I think you should double check which is the right syntax for a regexp with your version of grep, your system and your shell.
I read now your last edit: -o tells grep to print only the matched (non-empty) parts of a matching line. If your grep doesn't have the -o option, you can't use grep for that task. Try this modified version of the script, in which we use this kind of shell parameter expansion: ${parameter##pattern}.
I could now see it is reading the dates. But it doesnt seem to pick the files & copy it to destination directory.
I am pasting the actual log itself (with the actual directories etc).
LOL! That's easy.
You switched SINCE and TILL definitions. SINCE must go with SUB_DATE (easy way to avoid confusion: Since-Sub), and TILL must go with BUS_DATE.
Glad to see that egrep -o works extracting FILEDATE from FILENAME. So the problem was only the trailing $ in the regexp.
BTW: I see now that FILENAME ends with ".dat".
Hi All,
We have main directory called "head"
under this we have several sub directories and under these directories we have sub directories.
My requirement is I have to find the SQL files which are having the string "procedure" under "head" directory and sub directories as well.
And create... (14 Replies)
Hi All,
Daily i am doing the house keeping in one of my server and manually moving the files which were older than 90 days and moving to destination folder.
using the find command . Could you please assist me how to put the automation using the shell script .
... (11 Replies)
Hi all,
i have a folder, with tons of files containing as following,
on /my/folder/jobs/
some_name_2016-01-17-22-38-58_some name_0_0.zip.done
some_name_2016-01-17-22-40-30_some name_0_0.zip.done
some_name_2016-01-17-22-48-50_some name_0_0.zip.done
and these can be lots of similar files,... (6 Replies)
Hi,
Currently I'm moving the files based on date like below.
"mv *20150901* backup_folder" - Limitation: can move only 1 day files to backup folder.
I want to move the files of different dates like 20150901,02, 03, 04.....
Is there any single command to do it.
Thanks in advance!! (2 Replies)
I have a directory e2e_ms_xfer/cent01
this contains the multiple files some of which will be named below with unique date time stamps
e2e_ms_edd_nom_CCYYMMDD_HHMM.csv
What I want to do is in a loop
1) Get the oldest file
2) Rename
3) Move it up one level from e2e_ms_xfer/cent01 to... (1 Reply)
I have a directory e2e_ms_xfer/cent01
this contains the multiple files some of which will be named below with unique date time stamps
e2e_ms_edd_nom_CCYYMMDD_HHMM.csv
What I want to do is in a loop
1) Get the oldest file
2) Rename
3) Move it up one level from e2e_ms_xfer/cent01 to... (1 Reply)
Hi,
need to zip all files in a directory and move to another directory after the zip..
i am using this one but didnt help me...
zip -r my_proj_`date +%Y%m%d%H%MS`.zip /path/my_proj
mv in_proj_`date +%Y%m%d%H%M%S`.zip /path/source/
i am trying to zip all the files in my_proj... (0 Replies)
Hi All,
I am coding for a requirement where I need to read a file & get the values of SUB_DATE. Once the dates are found, i need to move the files based on these dates from one directory to another.
ie, this is how it will be in the file,
SUB_DATE = 20120608,20120607,20120606,20120606... (5 Replies)
Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management.
Thanks in advance-
Brian- (2 Replies)