05-29-2005
Find and Merge files
Hi,
I am relatively new to unix and I need to write a simple script to monitor a log directory. Being adventurous, I intend to pick up a couple of scripting to make my work more efficient.
I need to
1) merge files with names that starts with the same date
Example:
12052005.2alarm
12052005.3alarm
:
:
2) sort and grab relevant rows and resort them into a file in a prefixed time every day
3) automate the daily process as a daemon process ?is this the correct term?
4) A second daemon that merge the files from above steps weekly
Assistance required to
1) how to find files and merge the relevant files together?
I have thought of a solution but do not know how to carry it out as a script
#search for files
find date+*
#store the file names
???
#carry out a append of the files
cp ??? >> 'date'
2) I have completed and tested this section, I had used GREP then a UNIQ to acomplish the task
3) How to write a script that will carry out a certain function at the predefined interval? (daily at XXXXh and weekly at mon XXXXh)
4) I believe that the solution for 3 can be altered for this function
Thanks a lot
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have created these files in a particular directory
a_1.txt
a_2.txt
...
..
a_n.txt
Each file has a single line.
I want to write a output file a.txt, which will have concantated value of string from all the files.
which utility should i use. copy, cat or paste????
Can anyone help... (5 Replies)
Discussion started by: u263066
5 Replies
2. Shell Programming and Scripting
hi,
i am facing a problem in merging two files using awk,
the problem is as stated below,
file1:
A|B|C|D|E|F|G|H|I|1
M|N|O|P|Q|R|S|T|U|2
AA|BB|CC|DD|EE|FF|GG|HH|II|1
....
....
....
file2 :
1|Mn|op|qr (2 Replies)
Discussion started by: shashi1982
2 Replies
3. Shell Programming and Scripting
Hi All,
I have two files file1 and file2 as below.
cat file1
200000040;20.0
200000020;40.0
200000060;10
200000100;.0.5
----------------
cat file2
200000020
200000100
200000040
200000060
I want to merge... (4 Replies)
Discussion started by: girish.raos
4 Replies
4. Shell Programming and Scripting
Given are File A and File B
File A has for example 5 lines:
AAA
BBB
CCC
DDD
EEE
File B has 3 lines:
111
222
333
How can i merge A and B into:
111
222
333
AAA (first line from A)
then a new file: (4 Replies)
Discussion started by: Y-T
4 Replies
5. Shell Programming and Scripting
Hi,
My requirement is,there is a directory location like:
:camp/current/
In this location there can be different flat files that are generated in a single day with same header and the data will be different, differentiated by timestamp, so i need to verify how many files are generated... (10 Replies)
Discussion started by: srikanth_sagi
10 Replies
6. Shell Programming and Scripting
Hi,
I have a file (sorted by sort) with 8 tab delimited columns. The first column contains duplicated fields and I need to merge all these identical lines.
My input file:
comp100002 aaa bbb ccc ddd eee fff ggg
comp100003 aba aba aba aba aba aba aba
comp100003 fff fff fff fff fff fff fff... (5 Replies)
Discussion started by: falcox
5 Replies
7. Shell Programming and Scripting
a.txt
id name subject
12 aaa History
23 bbb Science
45 ccc Zoology
b.txt
id layer LayerNo
12 xxx12 1
23 yyy23 2
23 lll23 3
45 xxx45 1
45 yyy45 2
45 lll45 3
i have file a.txt which is parent file and another children file b.txt . Both files are linked together by common field... (2 Replies)
Discussion started by: manas_ranjan
2 Replies
8. Shell Programming and Scripting
Hi Gurus,
I have two files as below
file1
abc
cde
cdd
cdf
file2
123
234
345
456
I want to get
abc 123
cde 234
cdd 345 (3 Replies)
Discussion started by: ken6503
3 Replies
9. Shell Programming and Scripting
Dear Gents,
Please I need your help... I need small script :) to do the following.
I have a thousand of files in a folder produced daily.
I need first to merge all files called. txt (0009.txt, 0010.txt, 0011.txt) and and to output a resume of all information on 2 separate files in csv... (14 Replies)
Discussion started by: jiam912
14 Replies
10. Shell Programming and Scripting
Hi,
i have input files like below:-
input1
Name Seq_ID NewID Scores
MT1 A0QZX3 1.65 277.4
IVO A0QZX3 1.65 244.5
HPO A0QZX3 1.65 240.5
RgP A0Q3PP 5.32 241.0
GX1 LPSZ3S 96.1 216.9
MEL LPSS3X 4.23 204.1
LDD LPSS3X 4.23 100.2
input2
Fac AddName NewID ... (9 Replies)
Discussion started by: redse171
9 Replies
LEARN ABOUT DEBIAN
cfetoolgraph
CFETOOLGRAPH(8) User Contributed Perl Documentation CFETOOLGRAPH(8)
NAME
cfetoolgraph - create graphs from a cfetool database
SYNOPSIS
cfetoolgraph name [--path|-p directory name] [--daily|-d] [--weekly|-w] [--yearly|-y] [--timestamps|-T] [--resolution|-r] [--help|-h]
DESCRIPTION
The cfetoolgraph command dumps graphs of averages for visual inspection of the normal state database. The files are in a format viewable by
"gnuplot" or "xgmr" or other graphical plotting program.
The command generates three or four files in a subdirectory of the database directory with a name beginning with either "daily", "weekly"
or "yearly", then "-", then either "snapshot" or the current time, if the -T option is used. The files are named "average", "stddev", and
"graph". The "graph" file contains both the averages and standard deviations, useful for plotting with error bars.
If a histogram file is present, a fourth file named "distr" will also be created, plotting the distribution of fluctuations about the mean
value.
If the -d, -w and -y options are all omitted, the default is to only graph the weekly database.
OPTIONS
--path|-p directory name
The directory in which the database specified by name can be found.
--daily|-d
Graph the daily averages database.
--weekly|-w
Graph the weekly averages database.
--yearly|-y
Graph the yearly averages database.
--timestamps|-T
Time-stamp the output filenames with the current time, in order to give a unique name.
--resolution|-r
Generate high resolution data (), instead of averaging data over periods of one hour to generate simpler and smoother graphs.
--help|-h
Prints a short help message and then exits.
EXAMPLE
% cfetoolgraph temperature --path /my/path --resolution
Create graph files of the weekly database in high resolution in the "/my/path/temperature/weekly-snapshot" directory.
AUTHORS
The code and documentation were contributed by Stanford Linear Accelerator Center, a department of Stanford University. This documentation
was written by
Elizabeth Cassell <e_a_c@mailsnare.net> and
Alf Wachsmann <alfw@slac.stanford.edu>
COPYRIGHT AND DISCLAIMER
Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
Elizabeth Cassell <e_a_c@mailsnare.net>
All rights reserved.
perl v5.8.4 2004-09-21 CFETOOLGRAPH(8)