|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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 Developers” Download Now!
|
|
#1
|
|||
|
|||
|
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.
|
|
#2
|
|||
|
|||
|
sample lines please
|
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
Quote:
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? |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Script help please. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|