Sponsored Content
Full Discussion: awk search pattern
Top Forums Shell Programming and Scripting awk search pattern Post 302455006 by Franklin52 on Monday 20th of September 2010 02:04:25 PM
Old 09-20-2010
Assuming starttime and endtime are shell variables:

Code:
starttime="2010 07 19 07 13 19"
endtime="2010 07 19 07 30 00"

awk -F, -v stime="$starttime" -v etime="$endtime" '
BEGIN{gsub(" ","",stime);gsub(" ","",etime)}
/^[0-9]/{
  t=$1
  gsub("[ -:]","",t)
}
t >= stime{p=1}
t > etime{p=0}
p' logfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

blind search pattern with AWK

Hello, I am using a if condition within my awk script and I have a problem with the search pattern. I would like awk to find all the fields starting with 123. For now I have something like that: awk '{for(i=1;i<9;i+=2)if($i=="123"...)print $i}' test but that is not working as... (2 Replies)
Discussion started by: jolecanard
2 Replies

2. Shell Programming and Scripting

AWK:- matching pattern search

Dear Friends, I have a flat file. To pick certain details we have written an awk where we are facing difficulty. Sample of flat file. line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 line 11 line 12 line 13 line 14 (Matching pattern "Lkm_i-lnr:"can be... (4 Replies)
Discussion started by: anushree.a
4 Replies

3. Shell Programming and Scripting

Pattern Search using AWK

Hi All, I have the below file data.txt.Using awk i want to grep all the zone data.Form the below command i can extact data upto of zone i give but i want it should print until next pattern. awk '/^Total Collection /{c=5;next}c-->0' zin45srs08.tools_utilization instead of c=5 is it possible... (5 Replies)
Discussion started by: ajaincv
5 Replies

4. UNIX for Dummies Questions & Answers

Pattern search using awk

Hi All, I am trying to find numbers with balance greater than 1 and less than equal 2 from the below file using awk Input file num ,bal 100199,1.708 100225,0 100226,0 100228,0.771166 100232,2 output file 100199,1.708 100232,2 I am using the following command for this... (2 Replies)
Discussion started by: pistachio
2 Replies

5. Shell Programming and Scripting

awk get search pattern from a file.

Here Is a problem I am facing with awk. Query --> I want to search for a string in a file and print next 15 lines below the matched string. 1.We do not have GNU grep so cannot use grep -A or grep -B commands. 2. Instead of passing the search pattern as a string to awk. I want the awk to... (4 Replies)
Discussion started by: togotutor
4 Replies

6. Shell Programming and Scripting

Awk to match a pattern and perform a search after the first pattern

Hello Guyz I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline ABC DEF LMN EFG HIJ LMN OPQ In the above text i need to... (8 Replies)
Discussion started by: RickCharles
8 Replies

7. Shell Programming and Scripting

awk with multiple pattern search

Want to fetch a column with multiple pattern using awk. How to achieve the same. Tried cat test address : 10.63.20.92/24 address : 10.64.22.93/24 address : 10.53.40.91/24 cat test | awk '{print $3}' |awk -F "/" '{print $1}' 10.63.20.92 10.64.22.93 10.53.40.91 Is there any... (2 Replies)
Discussion started by: Manasa Pradeep
2 Replies

8. Shell Programming and Scripting

awk search pattern in column

Want to search a pattern in column using the below command which not helpful awk -F"\|" '$1 == '"${VAR}"' {print $1,$2}' file how to search using "==" with variable other than the below case. awk -F"\|" '$1 ~ /'"${VAR}"'/ {print $1,$2}' file (14 Replies)
Discussion started by: Roozo
14 Replies

9. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies

10. Shell Programming and Scripting

awk -Search pattern through Variable

Hello, We have wrote shell script for multiple file name search pattern. file format: <numner>_<20180809>.txt starting with single number and ending with 8 digits number Command: awk -v string="12_1234" -v serch="^+_+$" "BEGIN{ if (string ~/serch$/) print string }" If sting matches... (4 Replies)
Discussion started by: koti_rama
4 Replies
PMWTF(1)						      General Commands Manual							  PMWTF(1)

NAME
pmwtf - compares archives and report significant differences SYNOPSIS
pmwtf [-dz] [-p precision] [-q thres] [-S starttime] [-T endtime] [-B starttime] [-E endtime] [-x metric] [-X file] [-Z timezone] archive1 [archive2] DESCRIPTION
pmwtf compares the average values for every metric in either one or two archives, in a given time window, for changes that are likely to be of interest when searching for performance regressions. The archive log has the base name archive and must have been previously created using pmlogger(1). The pmlogsummary(1) utility is used to obtain the average values used for comparison. There are two sorts of invocation of the tool: with either one or two archives. In the first case, the only sensible command line requires use of all four time window arguments. These are specified using the same time window format described in PCPIntro(1), and are -S and -T for the start and end times of the first time window of interest in the archive, and -B and -E for the start and end times of the second time window of interest. In the second case, with two archives, the -B and -E options might be unnecessary. This might be the case, for example, when comparing the same time window of two consecutive days (usually two separate archives), or a time window on the same day of different weeks. In either case, pmwtf produces a sorted summary of those metrics in the specified window whose values have deviated the most from a minimal threshold. The level of deviation is calculated by dividing the average value of each metric in both logs, and then calculating whether the ratio falls outside of a range considered normal. This ratio can be adjusted using the -q option, and by default it is 2 (i.e. report all metrics with average values that have more than doubled in the two time windows or more than halved in the two time windows). Should any metrics be present in one window but missing from the other, a diagnostic will be displayed listing each missing metric and the archive from which it was missing. The remaining options control the specific information to be reported. Metrics with counter semantics are converted to rates before being evaluated. -p Print all floating point numbers with precision digits after the decimal place. -x Compare each metric in each archive in the time windows specified to a given egrep(1) pattern, excluding those that match from the report output. -X Allows a file to be specified which containing egrep(1) patterns which are applied to the metric names to optionally exclude some from the report. -z Use the local timezone from the given archives. -Z Changes the timezone in the archive labels to timezone in the format of the environment variable TZ as described in environ(5). FILES
$PCP_LOG_DIR/pmlogger/hostname Default directory for PCP archives containing performance metric values collected from the host hostname. PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
PCPIntro(1), pmlogger(1), pmlogsummary(1), egrep(1), pcp.conf(5) and pcp.env(5). Performance Co-Pilot PCP PMWTF(1)
All times are GMT -4. The time now is 05:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy