The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to log start/stop time of ALL processes bluesky099 UNIX for Advanced & Expert Users 10 12-18-2007 12:01 AM
Searching files by last accessed time Trellot UNIX for Dummies Questions & Answers 4 11-23-2007 11:28 PM
Start time/end time and status of crontab job thambi Shell Programming and Scripting 3 05-16-2007 10:24 AM
to get process start date and time naeem ahmad UNIX for Advanced & Expert Users 2 02-27-2006 05:09 AM
get process start time naeem ahmad High Level Programming 1 02-06-2006 08:40 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-29-2009
wakhan wakhan is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 58
searching between start and end time

Hello All,

Below mentioned is my log file.

I want to make a script which ask for start time and then end time and then search particular word between those lines.

Like
start time:2
end time: 4
and then search all values starting from cell 84 between this time.

Please Help

Regards,

Code:
01/29/09 02:20:39 #283986
^Y
M 15 OP:ALARM
     CELL 74, CDM 1 CDMA BASEBAND RADIO (CBR) 2
     CELL 74, CDM 1 CDMA BASEBAND RADIO (CBR) 3
     CELL 74, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 1
     CELL 74, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 1
     CELL 74, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 1
     CELL 74, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 2
     CELL 74, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 2
     CELL 74, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 2
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 1
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 2
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 4
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 5

01/29/09 03:10:39 #283986
^Y
M 15 OP:ALARM
     CELL 74, CDM 1 CDMA BASEBAND RADIO (CBR) 2
     CELL 74, CDM 1 CDMA BASEBAND RADIO (CBR) 3
     CELL 74, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 1
     CELL 74, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 1
     CELL 74, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 1
     CELL 74, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 2
     CELL 74, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 2
     CELL 74, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 2
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 1
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 2
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 4
     CELL 74, ASMB 1 TRANSMITTER AMP INDETERMINATE 5

01/29/09 04:01:39 #283986
^Y
M 15 OP:ALARM
     CELL 14, CDM 1 CDMA BASEBAND RADIO (CBR) 2
     CELL 24, CDM 1 CDMA BASEBAND RADIO (CBR) 3
     CELL 34, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 1
     CELL 34, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 1
     CELL 34, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 1
     CELL 84, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 2
     CELL 84, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 2
     CELL 84, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 2
     CELL 4, ASMB 1 TRANSMITTER AMP INDETERMINATE 1
     CELL 54, ASMB 1 TRANSMITTER AMP INDETERMINATE 2
     CELL 54, ASMB 1 TRANSMITTER AMP INDETERMINATE 4
     CELL 64, ASMB 1 TRANSMITTER AMP INDETERMINATE 5

01/29/09 05:01:39 #283986
CELL 34, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 1
     CELL 84, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 2
     CELL 84, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 2
     CELL 84, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 2
     CELL 4, ASMB 1 TRANSMITTER AMP INDETERMINATE 1
     CELL 54, ASMB 1 TRANSMITTER AMP INDETERMINATE 2
     CELL 54, ASMB 1 TRANSMITTER AMP INDETERMINATE 4
     CELL 64, ASMB 1 TRANSMITTER AMP INDETERMINATE 5
01/29/09 06:01:39 #283986
  #2 (permalink)  
Old 01-29-2009
majormark majormark is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 35
Run the code below from a script with the parameters like this: "start" "end" "search string".

Code:
cat your_log_file | awk "/01\/29\/09 0$1:20:39/,/01\/29\/09 0$2:10:39/{print}" | awk "/$3/{print}"
  #3 (permalink)  
Old 01-30-2009
wakhan wakhan is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 58
Hello All ,

I am using the below code to find my desired line between start and end line. Red marked are my start and end time and i want to
find the desired line between them. Can you please check and correct my script because below code is not working with arguments.

Code:
echo "ENTER FIRST:"
read GR
echo "ENTER SECOND:"
read QR
cat /omp/omp-data/logs/OMPROP1/090130.APX  | nawk -v END=$GR START=$QR  "/END/{exit}/START/{print}" | nawk "/CARRIER/{print}"

01/29/09 01:00:59 #493740
^Y
A 00 REPT:CELL 30 CP FAILURE, ANSWERED TERMINATION
     LOST CALL
     DCS 1 TG 998 TM 385 SG 0 ANT 1
     CARRIER 2, CHAN UNAVAIL FS-ECP ID 1, SYS ID 13
     DN 0218351023, MIN 0218351023, IMSI UNAVAIL
     SN X2b5332b6 SCM ea
     ALW CDMA, ASGN CDMA
     CDM 1, CCU 1, CE 93, PP 3, ECP ID 1, SYS ID 13

01/30/09 02:00:00 #493741
But below mentioned line is working:
it starts from the word A and when 01/30/09 comes it stops and prints the line starting from CARRIER.

Code:
cat /omp/omp-data/logs/OMPROP1/090130.APX  | nawk  "/01\/30\/09/{exit}/A/{print}" | nawk "/CARRIER/{print}"

Last edited by wakhan; 01-30-2009 at 04:10 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0