UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 4th, 2003, 10:36 PM
chatguy2020 chatguy2020 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 chatguy2020 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
shell script that reads a file

Hi all!!

I am totally new to shell scripting.

I need a korn shell script that will monitor a log file (shown below). It should scan the log file for distinct ip addresses. When the log file is deleted or a new file is created, the shell script should detect that.

For example, if at 11:00 pm the shell script detects 20 distinct ip addresses, and if at 11:10 the log file is deleted and a new one is created, then when we execute the script at 11:15, the shell script should return all the ip addresses (20 + the ip addresses from new file).

Therefore, the shell script should finally give the number of current ip addresses (distinct) at the end. To make things more clear, this script is used to track the number of current users using a server.

A snippet of log file is as shown below. 333.333.333.333 is the ip address. ip addresses are always preceded by the word AAD@.

------------------
10:54:11 [crelay_child-106762-0]: Reading local IPC message...
10:54:11 [crelay_child-106762-0]: Writing 220 bytes : LOGIN_MSG_RSP[-726510107](1)
URL->AAD@333.333.333.333
10:54:12 [crelay_child-106762-0]: Scheduled send message to client on sfd 5

------------------

Sorry if this is a tough question. Your help will be greatly appreciated.

Thanks a lot in anticipation!!!

chatguy2020.

Reply With Quote
  #2  
Old July 20th, 2003, 04:52 PM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,317 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 5 h 42 m 28 sec
Reputation Power: 109
Send a message via ICQ to christo Send a message via Yahoo to christo
Just wondering if you have considered doing this in PERL - it's quite a lot more flexible than ksh for this sort of thing. I'd definitely use PERL for parsing and matching -type tasks like this.

just a thought.

christo
__________________
This is me: http://chris.uk.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > shell script that reads a file

Developer Shed Advertisers and Affiliates



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap