SkySmart,
I have yet to see a clear definition of what the submitter wants to be matched by the patterns given. For example, with the following input:
should error match error|, error,, and error123 as well as when error is at the start or end of a line and when it is preceded and followed by whitespace characters. The following seems to do what is wanted if all of the above are supposed to match:
If you don't want to match 123error and error123, change both occurrences of :alpha: in the code above to :alnum:.
The the vast majority of your input lines will contain one or more of your search patterns, this will probably run faster if you remove the code shown in red.
With the above sample input file, this script produces the output:
You also have yet to explain why your script was eliminating line 1 and lines 128501 and above from your input file. Until we know what is special about these lines and what is on them, we won't be able to help you make adjustments to these awk and egrep commands to solve your problem. I agree with Chubler_XL that egrep looks like a better solution than awk, but depending on what you're trying to match, the ERE operand may need to be significantly modified and the -w option removed before invoking egrep. Furthermore, if some lines do need to be treated specially, awk becomes more attractive.
This User Gave Thanks to Don Cragun For This Post:
Optimization shell/awk script to aggregate (sum) for all the columns of Huge data file
File delimiter "|"
Need to have Sum of all columns, with column number : aggregation (summation) for each column
File not having the header
Like below -
Column 1 "Total
Column 2 : "Total
...
...... (2 Replies)
Hi,
I need some help to optimize this piece of code:
sqlplus -S $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i UNDO_001_COD3 | awk '{printf ";TBS_UNDO_001_COD3"$5"\n"}'
sqlplus -S $DB_USER/$DB_PWD@$DB_INSTANCE... (1 Reply)
hi guys ,
I have 10 scripts
suppose 1.sh , 2.sh ,3.sh ,4.sh ......10.sh
each takes some time ( for instance 2 minutes to 40 minutes )
my server can run around 3-4 files at a time
suppose,
1.sh ,
2.sh ,
3.sh
are running currently now as soon as ANY ONE of the gets finished i... (4 Replies)
Hello all,
Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val:
> cat getnon0file.sh
#!/bin/bash
this="getnon0file.sh"
USAGE=$this"
InFile="xyz.38"
Min="0.05"
#
awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
I have created Shell script with below awk code for replacing special characters from input file.
Source file has 6 mn records. This script was able to handle 2 mn records in 1 hr. This is very slow speed and we need to optimise our processing.
Can any Guru help me for optimization... (6 Replies)
I have a process using the following series of sed commands that works pretty well.
sed -e 1,1d $file |sed 1i\\"EHLO Broadridge.com" |sed 2i\\"MAIL FROM:${eaddr}"|sed 3i\\"RCPT TO:${eaddr}"|sed 4i\\"DATA"|sed 5s/.FROM/FROM:/|sed 6s/.TO/TO:/|sed 7,7d|sed s/.ENDDATA/./|sed s/.ENDARRAY// >temp/$file... (1 Reply)
Hello,
Do you have any tips on how to optimize the AWK that gets the lines in the log between these XML tags?
se2|6|<ns1:accountInfoRequest xmlns:ns1="http://www.123.com/123/
se2|6|etc2">
.... <some other tags>
se2|6|</ns1:acc
se2|6|ountInfoRequest>
The AWK I'm using to get this... (2 Replies)
:o Hi,
I am writing a script in which at some time, I need to get the process id of a special process and kill it...
I am getting the PID as follows...
ps -ef | grep $PKMS/scripts | grep -v grep | awk '{print $2 }'can we optimize it more further since my script already doing lot of other... (3 Replies)