The UNIX and Linux Forums  


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
Small Search script appu1987 Shell Programming and Scripting 2 06-03-2008 11:14 PM
Help with search script bsandeep_80 UNIX for Advanced & Expert Users 9 09-06-2007 09:25 AM
Search File Script I4ce Shell Programming and Scripting 7 03-28-2006 03:12 PM
Search script BCarlson Shell Programming and Scripting 14 02-05-2006 02:50 AM
script to search all the directories abk Shell Programming and Scripting 3 07-10-2002 01:19 AM

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 08-05-2008
fuzion.hyd fuzion.hyd is offline
Registered User
  
 

Join Date: Aug 2008
Location: Virginia
Posts: 1
Log Search Script

Hi,

I am trying to write a script to search a log- IPaddress being the search criteria, I would ideally like the script to ask the ipaddress

Enter IP address - 244.258.27.225

And the ideal result would be for the script to get all the entries in the log file for a particular IP address,

  • echo -n "IP address ?
  • "read ip_addr
Please help me, Im new to scripting.


Thanks for your time
  #2 (permalink)  
Old 08-05-2008
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,802

Code:
echo "enter IP address:\c"
read ip
grep $ip logfile

Be aware that 244.258.27.225 has dots in it - there are some ways dots could change the search result because regular expressions use dots as a special character. If you run into problems check back here.
  #3 (permalink)  
Old 08-05-2008
broli's Avatar
broli broli is offline
Registered User
  
 

Join Date: Dec 2007
Location: Argentina
Posts: 215
Quote:
Originally Posted by jim mcnamara View Post
Code:
echo "enter IP address:\c"
read ip
grep $ip logfile

Be aware that 244.258.27.225 has dots in it - there are some ways dots could change the search result because regular expressions use dots as a special character. If you run into problems check back here.
be sure to check greps manual page. in basic regular expressions the . (dot) dosnt have any special meaning (not at least acording to the manual page of my system with GNU grep 2.5.1 )
  #4 (permalink)  
Old 08-05-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Unhappy Guessing that this is homework too...

Now, including this one, I see three of the same questions.
By rules, homework assistance is not allowed.

Timestamp Search

{How} Script to search a log file for a given criteria
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 11:09 AM.


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