I have to read the file, in each line of file i need to get 2 values using more than one search pattern.
ex: <0112 02:12:20 def > /some string/some string|[match string]|some string||124
i donot have same delimiter in the line, I have to read '0112 02:12:20' which is timestamp, and last field '124' which is the value I use to sum it to get the average value for the match string during that time frame. I have to use regex to match the line using 'match string; and also the timestamp because I want to get the lines between some time frame(like I want to read only the lines with timestamp between yesterday 6pm to today 4pm).
After I got the values of all the match string last field values then I will add it all last field values to get the average for that match string.
Assuming that -
(1) The string you want to match is "right_string".
(2) The range of timestamps is yesterday 6 pm to today 4 pm.
and given your data file that looks like this -
you can use a Perl script like the following that picks up the numbers at the far right and pushes them into an array. The average is calculated in the END section -
Of course if your data is going to span multiple years, then the date on the left must include the year as well i.e. "03092010" instead of "0309". And the script will have to be modified so as to take care of that as well.
I'm trying to parse COBOL code to combine variables into one string. I have two variable names that get literals moved into them and I'd like to use sed, awk, or similar to find these lines and combine the variables into the final component. These variable names are always VAR1 and VAR2. For... (8 Replies)
i have an oracle function which returns two values, one is the error message if the function encounters anything and another one which returns a number
i need to capture both
and pass it on to unix shell script
how to do it (2 Replies)
I have a K shell script (ksh) that needs to return an email address. A C program was written (prog1) to now access the email address off of an oracle table. The call to the program in the ksh is
prog1 -p parm1
Based on Parm1 the program will read an oracle table and retrieve the email... (2 Replies)
Hi,
I have to write one script that has to search a list of numbers in certain zipped files.
For eg. one file file1.txt contains the numbers. File1.txt contains 5,00,000 numbers and I have to search each number in zipped files(The number of zipped files are around 1000 each file is 5 MB)
I have... (10 Replies)
Hi All,
I am connecting to Oracle DB from UNIX script. Want to capture all dates between start date and end date and store them in file. Once this is done, want to read dates one by one. How to achive this in UNIX and Oracle? Please let me know if you have any idea on the same.
Thanks and... (4 Replies)
Hello All,
I'm in the middle of a script and I'm doing some checks with REGEX (i.e. using the '"shopt -s nocasematch"
that at least the first one should print "FALSE" but it prints "TRUE"..?
For Example:
#!/bin/bash
MY_VAR="HELLO"
### This prints "TRUE"
PATTERN_1="^*"
if ]
then... (5 Replies)
Hi,
I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command.
Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns.
Xargs -I {} grep... (3 Replies)
Hi,
How can i delete values between 2 patterns like below:-
input.txt
192.1.1.2.22 blablabala
23.1.A.1.2 blablabalbl
5.4.1.1.12 blablaba
i need to delete all values between starting from "." no 3 and second column. the output should be:
192.1.1 blablabala... (15 Replies)
can someone please confirm for me if i'm right:
the pattern:
ORA-0*(600?|7445|4)
can someone give me an idea of all the entries the pattern above will grab from a database log file?
is it looking for the following strings?:
ORA-0600
ORA-7445
4) (2 Replies)
Hello All,
While googling on regex I came across a site named Regulex Regulex:JavaScript Regular Expression Visualizer
I have written a simple regex ^(a|b|c)(*)@(.*) and could see its visualization; one could export it too, following is the screen shot.
... (3 Replies)