UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Actuate
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:
Learn five alternative approaches for automating the delivery of Excel-based reports. Read all about it in the free whitepaper: “Automating Excel Reports: Five Approaches for Java DevelopersDownload Now!
  #1  
Old July 19th, 2004, 11:01 PM
princealbert princealbert is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 princealbert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Script help please.

Hello all, I'm new to script writing. I have a simple question how do I sort a logfile by i.p. addresses. Thank you.

Reply With Quote
  #2  
Old July 20th, 2004, 06:10 AM
zby zby is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Location: Prague, Czech Republic
Posts: 825 zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 16 h 4 m 55 sec
Reputation Power: 64
sample lines please

Reply With Quote
  #3  
Old July 21st, 2004, 11:21 PM
princealbert princealbert is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 princealbert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This is the way its setup to read the logfile now.


grep -i "login error" logfile | grep FS

I would like to sort the errors by i.p. address.

Reply With Quote
  #4  
Old July 22nd, 2004, 12:10 AM
zby zby is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Location: Prague, Czech Republic
Posts: 825 zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level)zby User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 16 h 4 m 55 sec
Reputation Power: 64
Quote:
Originally Posted by princealbert
This is the way its setup to read the logfile now.

grep -i "login error" logfile | grep FS

I would like to sort the errors by i.p. address.


I understand that.

I created a test source file like this:
SunOS SARCIS3 5.7 Generic_106541-15 sun4us sparc FJSV,GPUS
bash-2.03$ cat tosort
login error 10.6.45.67
login error 123.222.1.23
login error 12.12.200.213
login 12.34.56.78
login 121.32.111.87

went on with:
bash-2.03$ grep -i "login error" tosort | sort

and received:
login error 10.6.45.67
login error 12.12.200.213
login error 123.222.1.23

In my case first two fields are always the same per grepped ouput line.
In your case it should idealy be as fixed as mine output.
In my example I didn't have to use field oreinted sorting for the 'login error' string is at the beggining and the sorting itself starts with the third field where the IPs actualy are.
Field oriented sorting comes on the scene once you use:

sort -t char -k field_start[type][,field_end[type]] file1 file2 file3 ...

That is the reason I asked about example. I ment the grepped source file. Sorry for not being throughout with my requests once for all.

Is it possible to have such a fraction of your source file here?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Script help please.


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway