I wrote the below shell script to generate a report on alert messages recieved on a day. But i for processing around 4500 lines (alerts) the script is taking aorund 30 minutes to process.
Please help me to make it faster and improve the performace of the script. i would be very happy if this report gets generated within 5 mins - if possible
Below is my shell script
Code:
cp a_15.txt abc_15.txt && cp a_15.txt xyz_15.txt
total_word_count=0; match_word_count=0; alerts_matched=0;
while read outer_line
do
echo -e "$outer_line"
total_word_count=`echo $outer_line |tr '[ : .' ' ' |awk '{ print NF} '`
outer_line=`echo $outer_line |tr '[ : .' ' '`
##
while read inner_line
do
###
for word in $outer_line
do
echo $inner_line |grep -i -w "$word" 1>/dev/null
if [ $? -eq 0 ];then
match_word_count=`echo $match_word_count + 1|bc`
else
:
fi
done
###
match_pcnt=`echo "scale=2; $match_word_count/$total_word_count*100"|bc |awk -F"." '{print $1}'`
if [ $match_pcnt -ge 66 ];then
alerts_matched=`echo $alerts_matched + 1|bc`
inner_line=`echo $inner_line| tr '[ : .' '.'`
sed -i "s/$inner_line//g" ./abc_15.txt
sed -i '/^$/d' ./abc_15.txt
else
:
fi
match_word_count=0;
match_pcnt=0
done <./abc_15.txt
##
echo -e "\nALERTS_MATCHED: $alerts_matched\n\n"
alerts_matched=0;
cat ./abc_15.txt >./xyz_15.txt
done <./xyz_15.txt >APS.out
---------- Post updated at 10:00 AM ---------- Previous update was at 09:55 AM ----------
The alert messages (4000 lines) will be like below
Code:
ERROR (19:58:50,781 ERROR Thread-37-RunnerPool-Fast RamPricingQueryRunner.run:493 Got exception parsing VAN query result for product [APS .Q])
ERROR (19:45:40,529 ERROR Thread-26-RunnerPool-Std RamPricingQueryRunner.run:493 Got exception parsing VAN query result for product [APS .Q])
ERROR (01:31:24,073 ERROR Thread-214 STAbstractComputable.getComputeResult:114 Cycle detected at com.sample.es.calcrules.newstyle.RuleAwareMarketDataHolder@12345, key=rules|APS .Q, subject=APS .Q, , rule=com.sample.es
The report i want looks like below
Code:
ERROR (19:58:50,781 ERROR Thread-37-RunnerPool-Fast RamPricingQueryRunner.run:493 Got exception parsing VAN query result for product [APS .Q])
ALERTS_MATCHED: 300
ERROR (19:45:40,529 ERROR Thread-26-RunnerPool-Std RamPricingQueryRunner.run:493 Got exception parsing VAN query result for product [APS .Q])
ALERTS_MATCHED: 55
ERROR (01:31:24,073 ERROR Thread-214 STAbstractComputable.getComputeResult:114 Cycle detected at com.sample.es.calcrules.newstyle.RuleAwareMarketDataHolder@12345, key=rules|APS .Q, subject=APS .Q, , rule=com.sample.es
ALERTS_MATCHED: 700
Last edited by apsprabhu; 04-09-2010 at 02:38 AM..
Hi ,
i'm searching for files over many Aix servers with rsh command using this request :
find /dir1 -name '*.' -exec ls {} \;
and then count them with "wc"
but i would improve this search because it's too long and replace directly find with ls command but "ls *. " doesn't work.
and... (3 Replies)
Hi All,
I am using grep command to find string "abc" in one file .
content of file is
***********
abc = xyz
def= lmn
************
i have given the below mentioned command to redirect the output to tmp file
grep abc file | sort -u | awk '{print #3}' > out_file
Then i am searching... (2 Replies)
hi someone tell me which ways i can improve disk I/O and system process performance.kindly refer some commands so i can do it on my test machine.thanks, Mazhar (2 Replies)
I have a data file of 2 gig
I need to do all these, but its taking hours, any where i can improve performance, thanks a lot
#!/usr/bin/ksh
echo TIMESTAMP="$(date +'_%y-%m-%d.%H-%M-%S')"
function showHelp {
cat << EOF >&2
syntax extreme.sh FILENAME
Specify filename to parse
EOF... (3 Replies)
Hi All,
I have written a script as follows which is taking lot of time in executing/searching only 3500 records taken as input from one file in log file of 12 GB Approximately.
Working of script is read the csv file as an input having 2 arguments which are transaction_id,mobile_number and search... (6 Replies)
Hi,
I have around one lakh records. I have used XML for the creation of the data.
I have used these 2 Perl modules.
use XML::DOM;
use XML::LibXML;
The data will loo like this and most it is textual entries.
<eid>19000</eid>
<einfo>This is the ..........</einfo>
......... (3 Replies)
Hi ,
i wrote a script to convert dates to the formate i want .it works fine but the conversion is tkaing lot of time . Can some one help me tweek this script
#!/bin/bash
file=$1
ofile=$2
cp $file $ofile
mydates=$(grep -Po '+/+/+' $ofile) # gets 8/1/13
mydates=$(echo "$mydates" | sort |... (5 Replies)
Hello,
Attached is my very simple C++ code to remove any substrings (DNA sequence) of each other, i.e. any redundant sequence is removed to get unique sequences. Similar to sort | uniq command except there is reverse-complementary for DNA sequence. The program runs well with small dataset, but... (11 Replies)
Hello,
For several of our scripts we are using awk to search patterns in files with data from other files. This works almost perfectly except that it takes ages to run on larger files. I am wondering if there is a way to speed up this process or have something else that is quicker with the... (15 Replies)
Discussion started by: SDohmen
15 Replies
LEARN ABOUT DEBIAN
pegasus-tc-converter
PEGASUS-TC-CONVERT(1)PEGASUS-TC-CONVERT(1)NAME
pegasus-tc-converter - A client to convert transformation catalog from one format to another format.
SYNOPSIS
pegasus-tc-converter [-Dproperty=value...] [-v] [-q] [-V] [-h]
[-I fmt] [-O fmt]
[-N dbusername] [-P dbpassword] [-U dburl] [-H dbhost]
-i infile[,infile,...] -o outfile
DESCRIPTION
The tc-convert program is used to convert the transformation catalog from one format to another.
Currently, the following formats of transformation catalog exist:
Text
This is a easy to read multi line textual format.
A sample entry in this format looks as follows:
tr example::keg:1.0 {
site isi {
profile env "JAVA_HOME" "/bin/java.1.6"
pfn "/path/to/keg"
arch "x86"
os "linux"
osrelease "fc"
osversion "4"
type "installed"
}
}
File
This is a tuple based format which contains 6 columns.
RESOURCE LFN PFN TYPE SYSINFO PROFILES
A sample entry in this format looks as follows
isi example::keg:1.0 /path/to/keg INSTALLED INTEL32::LINUX:fc_4: env::JAVA_HOME="/bin/java.1.6"
Database
Only MySQL is supported for the time being.
OPTIONS -Dproperty=value
The -D option allows an experienced user to override certain properties which influence the program execution, among them the default
location of the user's properties file and the PEGASUS_HOME location. One may set several CLI properties by giving this option multiple
times.
The -D option(s) must be the first option on the command line. CLI properties take precedence over the file-based properties of the
same key.
-I fmt, --iformat fmt
The input format of the input files. Valid values for the input format are: File, Text, and Database.
-O fmt --oformat fmt The output format of the output file. Valid values for the output format are: File, Text, and Database.
-i infile[,infile,...] --input infile[,infile,...] The comma separated list of input files that need to be converted to a file in the
format specified by the --oformat option.
-o outfile, --output outfile
The output file to which the output needs to be written out to.
Other Options
-N dbusername, --db-user-name dbusername
The database user name.
-P dbpassword, --db-user-pwd dbpassword
The database user password.
-U dburl, --db-url dburl
The database url.
-H dbhost, --db-host dbhost
The database host.
-v, --verbose
Increases the verbosity of messages about what is going on. By default, all FATAL ERROR, ERROR , CONSOLE and WARNINGS messages are
logged.
-q, --quiet
Decreases the verbosity of messages about what is going on. By default, all FATAL ERROR, ERROR , CONSOLE and WARNINGS messages are
logged.
-V, --version
Displays the current version number of the Pegasus Workflow Planner Software.
-h, --help
Displays all the options to the pegasus-tc-converter command.
EXAMPLE
Text to file format conversion
pegasus-tc-converter -i tc.data -I File -o tc.txt -O Text -v
File to Database(new) format conversion
pegasus-tc-converter -i tc.data -I File -N mysql_user -P mysql_pwd -U jdbc:mysql://localhost:3306/tc -H localhost -O Database -v
Database (username, password, host, url specified in properties file) to text format conversion
pegasus-tc-converter -I Database -o tc.txt -O Text -vvvvv
AUTHORS
Prasanth Thomas
Pegasus Team http://pegasus.isi.edu
05/24/2012 PEGASUS-TC-CONVERT(1)