Once you get to the directory where there are .log files, you can do
That creates a list of all ".log" files, latest first.
The above assumes (probably incorrectly) there are no directories under the one you are currently in. In that case another sed command immediately follow the "ls -tl" command to remove all lines starting with total or the letter d.
A driver script would start the above code starting with "find .. -name '*.log', redirecting its output (full path to each log file). Lines containing "/copy/" would first need to be taken out. A dirname or other utility would be run on the resulting file to leave only the path to each file and it would then be sorted uniquely to provide a list of all directories where the script described in the first paragraph would be run.
Also, the code in the first paragraph should probably start with "cd $1" with each directory where this is to be done since this parameter will be provided by your driver script.
I'm not sure if there should be ANY regular files in the /dev directory...
And, how can /dev/abc/xyz/a_2_123020131.log result in a copy /dev/abc/xyz/copy/a_2_12302013.log?
Latest compared by files' time stamps or file name elements? Can there be duplicate file names across directories, and what to do in such case?
HI everyone,
I been to this site before for help and found my answers on other threads now I am posting my own :).
I have a list of file names with out extensions on an txt file. I need a way for the script to search on the server for each file name and copy the files over to a new directory.... (12 Replies)
Hi All,
I am new to shell srcipting.
Problem :
I need to write a script which copy the log files from /prod/logs directory based on todays date like (Jul 17) and place it to /home/hzjnr0 directory and then search the copied logfiles for the string "@ending successfully on Thu Jul 17". If... (2 Replies)
So I have extremely limited experience with shell scripting and I was hoping someone could point out a few commands I need to use in order to pull this off with a shell script like BASH or whatnot (this is on OS X).
I need to search out for filenames with account numbers in the name itself... (3 Replies)
I am a newbie and would like some help with the following -
Trying to search fileA for a string similar to -
AS11000022010 30.4 31.7 43.7 53.8 60.5 71.1 75.2 74.7 66.9 56.6 42.7 32.5 53.3
I then want to replace that string with a string from fileB - ... (5 Replies)
Hello Linux Masters,
I am not a linux expert therefore i need help from linux gurus.
Well i have a requirement where i need to search all files based on first patterns and after seraching all files then serach second pattern in all files which i have extracted based on first pattern.... (1 Reply)
Hello
Im new to this forums, I would like some help regarding a script that I need in order to copy some files. Heres the scenario:
I need to search several files which have a particular code inside, lets say "test" all of them on different directories. I need to copy all of them on a new... (4 Replies)
Can i search in a file for more than one string at a time? And copy the next string after that and paste it in column style? Is it possible? Thanks! (4 Replies)
Hi I need to search the some ftp files created in last 24 hours and copy them to a directory with date stamp attached to it.
Iam using following command to search the files
find $CA_OUT_PATH/*/ftp_out -type f -mtime -1
but now how to copy these files to some other directory one by one ... (1 Reply)
Hi I need to search the some ftp files created in last 24 hours and copy them to a directory with date stamp attached to it.
Iam using following command to search the files
find $CA_OUT_PATH/*/ftp_out -type f -mtime -1
but now how to copy these files to some other directory one by one
with... (1 Reply)