Sponsored Content
Top Forums Shell Programming and Scripting How can I get entries between two points Post 302222857 by openspark on Thursday 7th of August 2008 04:31:29 PM
Old 08-07-2008
Error

Hi,
Thanks for your replies, actually I tried both the methods but it doesnt seem to pick up the log entries between the start and end times, The above code

Quote:
Originally Posted by MikaBaghinen
or without sed, but 6 lines instead of one:

#! /usr/bin/ksh
#
#
#
#
TOT_LENGTH=`wc -l request.log | awk '{print $1}' | tr -d " "`
START_LINE=`grep -n "Start - 07/Aug/2008:18:26:43" request.log | cut -f1 -d:`
STOP_LINE=`grep -n "End - 07/Aug/2008:19:36:43" request.log | cut -f1 -d:`
LAST_PART=`expr $TOT_LENGTH - $START_LINE`
DIFF_START_END=`expr $STOP_LINE - $START_LINE`
tail -$LAST_PART request.log | head -$DIFF_START_END
###
Gives a syntax error

I tried using the following methods also but without any result

1. awk /'06\/Aug\/2008:18:26:43/,/06\/Aug\/2008:18:36:43/' request.log

2. sed -n -e '/06\/Aug\/2008:18:26:43/,/06\/Aug\/2008:18:36:43/' -e '/06\/Aug\/2008:18:36:43/q' request.log

3. awk '/06\/Aug\/2008:18:26:43/&&f{exit}f;/06\/Aug\/2008:18:36:43/{f++}' request.log

A sample log entry is as follows

198.232.219.21 - ukla_portal_23@ukla.com [07/Aug/2008:14:51:23 -0400] "GET HTTPS://modulemgr.stage.ukla.com/mys...e_services.gif HTTP/1.1" 200 148
198.232.219.21 - ukla_portal_23@ukla.com [07/Aug/2008:14:55:23 -0400] "GET HTTPS://modulemgr.stage.ukla.com/mys...vice_green.gif HTTP/1.1" 200 3168
198.232.219.21 - ukla_portal_23@ukla.com [07/Aug/2008:15:05:23 -0400] "GET HTTPS://modulemgr.stage.ukla.com/mys.../gray_line.gif HTTP/1.1" 200 371

The above is just a sample and there are close to 10000 lines in a log file in an hour.

Please help me in finding the entries between two points (Start - End )

Your help is greatly appreciated !

Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

mount points

sometimes in Solaris 8 when I go to mount filesystems using either the mount command or by editing the /etc/vfstab, i get a nice little error message saying the the number of allowable mount points has been exceeded. I have read man pages until I am blue in the face and no where can I find what the... (3 Replies)
Discussion started by: manderson19
3 Replies

2. UNIX for Dummies Questions & Answers

Mount Points at reboot

How do I make a mount point reconnect at boot without editing /etc/fstab? Is there an option (or switch) to make this persistent when issuing the mount command from a client? (1 Reply)
Discussion started by: AIXdumb455
1 Replies

3. UNIX and Linux Applications

Gnuplot question: how to plot 3D points as colored points in map view?

I have a simple gnuplot question. I have a set of points (list of x,y,z values; irregularly spaced, i.e. no grid) that I want to plot. I want the plot to look like this: - points in map view (no 3D view) - color of each point should depend on its z-value. - I want to define my own color scale -... (0 Replies)
Discussion started by: karman
0 Replies

4. UNIX for Advanced & Expert Users

mount points

hi, I believe a mount point does not have to be a physical disk, but rather a logical one? Is this correct? if so, how can I find out if my mount points are on different physical disks? thanks (9 Replies)
Discussion started by: JamesByars
9 Replies

5. Post Here to Contact Site Administrators and Moderators

Points?

Has any thought been given to assigning points to threads much in the way the HP ITRC forums do? This might not be possible, just a thought. (1 Reply)
Discussion started by: candlejack
1 Replies

6. Shell Programming and Scripting

Aggregated points

Combine points of specific key (a1) based on user defined size (lets say 200 in this example). so a1 191 and 191+200 and sum of all the values (4th column) and vice versa... Thanx a bunch! a1 191 201 1 a1 201 211 2 a1 211 221 1 a1 ....... .... a2......... ........ (7 Replies)
Discussion started by: quincyjones
7 Replies

7. Red Hat

Mount Points? How?

Hi folks, I have been asked to performed the following: Add the following new moint points systemA:/avp and SystemB:/usr/sap/trans to be the new linux server ZZZ How can I add those mount points and how those mount points can become another linuz server?:wall::wall::wall: (2 Replies)
Discussion started by: 300zxmuro
2 Replies

8. UNIX for Dummies Questions & Answers

Finding data value that contains x% of points

Hi, I need help on finding the value of my data that encompasses certain percentage of my total data points (n). Attached is an example of my data, n=30. What I want to do is for instance is find the minimum threshold that still encompasses 60% (n=18), 70% (n=21) and 80% (n=24). manually to... (4 Replies)
Discussion started by: ida1215
4 Replies

9. Shell Programming and Scripting

Returns points of an ellipse

Hi, Dose any one know, How can i return a 3D ellipse points if i have these information about the ellipse? All 3 length of axes, dip of each plane and azimuth of each axes. i.e., axes length=(1 cm, 2 cm, 3cm);dip of planes=(15 deg, 80 deg);azimuth of each axes=(10 deg,50 deg, 120 deg). I... (3 Replies)
Discussion started by: saeed.soltani
3 Replies

10. UNIX for Dummies Questions & Answers

Help with decimal points

Hi All, I would like to set decimal point to 16 in the following bash script but it has syntax error at }: awk '{printf"%.16e", (a<500,a++,$1/(a*1.1212121212121229e-02))}' input.dat >output.datHow may I set it in the correct way please? Thank you very much! (6 Replies)
Discussion started by: sxiong
6 Replies
GET_HEADERS(3)								 1							    GET_HEADERS(3)

get_headers - Fetches all the headers sent by the server in response to a HTTP request

SYNOPSIS
array get_headers (string $url, [int $format]) DESCRIPTION
get_headers(3) returns an array with the headers sent by the server in response to a HTTP request. PARAMETERS
o $url - The target URL. o $format - If the optional $format parameter is set to non-zero, get_headers(3) parses the response and sets the array's keys. RETURN VALUES
Returns an indexed or associative array with the headers, or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.1.3 | | | | | | | This function now uses the default stream con- | | | text, which can be set/changed with the | | | stream_context_set_default(3) function. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 get_headers(3) example <?php $url = 'http://www.example.com'; print_r(get_headers($url)); print_r(get_headers($url, 1)); ?> The above example will output something similar to: Array ( [0] => HTTP/1.1 200 OK [1] => Date: Sat, 29 May 2004 12:28:13 GMT [2] => Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) [3] => Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT [4] => ETag: "3f80f-1b6-3e1cb03b" [5] => Accept-Ranges: bytes [6] => Content-Length: 438 [7] => Connection: close [8] => Content-Type: text/html ) Array ( [0] => HTTP/1.1 200 OK [Date] => Sat, 29 May 2004 12:28:14 GMT [Server] => Apache/1.3.27 (Unix) (Red-Hat/Linux) [Last-Modified] => Wed, 08 Jan 2003 23:11:55 GMT [ETag] => "3f80f-1b6-3e1cb03b" [Accept-Ranges] => bytes [Content-Length] => 438 [Connection] => close [Content-Type] => text/html ) Example #2 get_headers(3) using HEAD example <?php // By default get_headers uses a GET request to fetch the headers. If you // want to send a HEAD request instead, you can do so using a stream context: stream_context_set_default( array( 'http' => array( 'method' => 'HEAD' ) ) ); $headers = get_headers('http://example.com'); ?> SEE ALSO
apache_request_headers(3). PHP Documentation Group GET_HEADERS(3)
All times are GMT -4. The time now is 07:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy