Hi there,
Here is what I currently have and trying to come up with a logic to automatically append logs to a respective year file. The log files might get generated everyday or any other day, irrespective of which I want to copy all of the logs for that year into one file /tmp/<year>.log and then copy the logs to new location /tmp/<newyear>.log when a newyear comes and so on.
Thanks for looking.
Last edited by mbak; 05-12-2016 at 08:34 PM..
Reason: typo
This doesn't seem to work as expected, it is removing the dated file 2016.log in this case after giving message "input file is output file'whereas I'm looking to append to it. I'm trying to figure out how to append to multiple dated log files for eg...all aaa.log files should append to one aaa.2016.log, bbb.log files in bbb.2016.log file and so on.
---------- Post updated at 11:30 PM ---------- Previous update was at 06:42 PM ----------
This is what I came up with and wondering if this could be made simpler or enhanced further, pls advise.
Although untested, this would seem to be a more efficient version of your latest script, producing the same outputs:
Note, however, that, by definition, /tmp is a directory intended to hold temporary files. You haven't said what operating system you're using, but on many systems, ALL files under /tmp are removed every time the system is rebooted. So, attempting to archive data from multiple years in files under /tmp is extremely dangerous. I strongly suggest that you choose a different directory as the base of your active and archived log files.
These 2 Users Gave Thanks to Don Cragun For This Post:
I have looked through several threads regarding merging files with awk and attempted using join however have been unsuccessful likely as I do not fully understand awk.
What I am attempting is to take a csv file which could be between 1 and 15,000 lines with 5 colums and another csv file that will... (4 Replies)
Hi All,
I have two files. File1 and File2.
Want to create another file with all the records of File1 those are not present in File2.
Please guide.
Thanks in advanced.
Anupam (3 Replies)
Hi Guys,
I have file A.txt
File A Data
AK1521
AK2536
AK3164
I want create text file of all data above and write some data on each file.
want Output on below folder
/home/kka/out
AK1521.txt
Hi
Welocme (3 Replies)
File A
I have list of :
ABCND1
ABCND2
ABCnd3
ABCnd4
I want file B like below
Start+
S Pate=ABCND1 AAlo1
S Pate=ABCND1 Q1234
S Pate=ABCND1,P12345 (7 Replies)
Hi folks,
I have the following data.Any help is greatly appreciated.
order File_name
7222245 7222245.pdf
7222245 7222245a.pdf
7222245 7222245b.pdf
7222245 7222245c.pdf
7222245 7222245d.pdf
7222250 ... (1 Reply)
Hello!!!!!!!!
I have an issue regarding inserting records in a file columnwise.Is it possible using awk/nawk script?
Example:
File1:
1|AAA|25|2
5|qqe|20|7
4|wer|31|81
I need to create a second file in which data can be inserted in a columnwise manner i.e.
File2:
AAA|25|1|2... (1 Reply)
Hi,
After checking all the UNIX threads, I am able to come up with a solution so far. I am working on a shell script where it moves the files to a certain directory. The conditions to check are
1) Check if the file exists in the current directory.
2) Check if the destination directory... (2 Replies)