![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing lines that are (same in content) based on columns | adsforall | UNIX for Dummies Questions & Answers | 7 | 11-09-2007 08:13 AM |
| remove duplicated lines without sort | lalelle | Shell Programming and Scripting | 6 | 08-21-2007 04:44 AM |
| Error when find and remove directory based on time | HAA | Shell Programming and Scripting | 1 | 02-01-2007 11:56 PM |
| Remove lines with n columns | Krispy | Shell Programming and Scripting | 2 | 11-10-2006 01:41 AM |
| Sort by Columns | murbina | UNIX for Dummies Questions & Answers | 1 | 05-10-2004 11:21 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
I guess you're looking for the most recent timestamp within an hour for your log file (?).
If sorting is not an issue use: Code:
awk '{split($NF,a,":"); b[a[1]]=$0}END{for (i in b) print b[i]}' MediaErr.log
Code:
sort -k 7.1,7.2n -k 7.4,7.5n -k 7.7,7.8n MediaErr.log | awk '{split($NF,a,":"); b[a[1]]=$0}END{for (i in b) print b[i]}'
Last edited by rubin; 05-10-2008 at 09:58 PM. Reason: typo, replaced sort keys 7.6,7.7 --> 7.7,7.8 in the last code. |
||||
| Google The UNIX and Linux Forums |