Sponsored Content
Top Forums Shell Programming and Scripting How to sort grep result based on timestamp? Post 302852073 by Corona688 on Tuesday 10th of September 2013 12:14:02 PM
Old 09-10-2013
It'll work either way, but it'd be much less work to sort after -- less data to sort.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sort for timestamp information-YYYY-MM-DD HH:MM:SS

Dear all, Please advice how do I sort a file based on timestamp information. I want to sort the second column in asc/desc order which has timestamp information in format YYYY-MM-DD HH:MM:SS Example File - Input.txt contains cat ss.txt 100|2009-03-30 11:38:43 141|2009-06-01 12:12:01... (1 Reply)
Discussion started by: sureshg_sampat
1 Replies

2. Shell Programming and Scripting

sort the files based on timestamp and execute sorted files in order

Hi I have a requirement like below I need to sort the files based on the timestamp in the file name and run them in sorted order and then archive all the files which are one day old to temp directory My files looks like this PGABOLTXML1D_201108121235.xml... (1 Reply)
Discussion started by: saidutta123
1 Replies

3. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

4. Programming

Sort the files on their name and then the timestamp using Perl

Hi All, I am new to Perl. I have a scenario to code. In a folder I have number of files and they will start with P01 or P02 or P03 and so on..I have to sort them on name first and then on time stamp. Ex. File name timestamp P01_file1.txt 1PM P02_file1.txt 1AM P01_file2.txt 2PM... (12 Replies)
Discussion started by: unankix
12 Replies

5. Shell Programming and Scripting

Output block of lines in a file based on grep result

Hi I would appreciate your help with this. I have a output file from a command. It is broken based on initial of the users. Exmaple of iitials MN & SS. Under each section there is information pertaining to the user however each section can have different number of lines. MY challenge is to ... (5 Replies)
Discussion started by: mnassiri
5 Replies

6. UNIX for Dummies Questions & Answers

Condition based on Timestamp (Date/Time based) from logfile (Epoch seconds)

Below is the sample logfile: Userids Date Time acb Checkout time: 2013-11-20 17:00 axy Checkout time: 2013-11-22 12:00 der Checkout time: 2013-11-17 17:00 xyz Checkout time: 2013-11-19 16:00 ddd Checkout time: 2013-11-21 16:00 aaa Checkout... (9 Replies)
Discussion started by: asjaiswal
9 Replies

7. Shell Programming and Scripting

Sort Unique Column with the most recent timestamp

Hello, I have a sample file with the below contents : Backup Oracle8_P112_PEGA_Archivedel Completed full 10/11/2015 03:50:06PM Backup Oracle8_G567_PEGA_Archivedel Completed full 10/11/2015 01:15:56PM Backup Oracle8_P112_PEGA_Archivedel Completed full ... (8 Replies)
Discussion started by: rahul2662
8 Replies

8. Shell Programming and Scripting

Find files and sort by timestamp

Used below command to get list of files sorted by timestamp find -L . -type f -name '*dat*' | xargs ls -ltrg I want to get only the filenames so I tried adding basename but it doenst work , can some one advise on how to get only file name (1 Reply)
Discussion started by: lalitpct
1 Replies

9. Shell Programming and Scripting

Grep lines between last hour timestamp and current timestamp

So basically I have a log file and each line in this log file starts with a timestamp: MON DD HH:MM:SS SEP 15 07:30:01 I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies
LOGTOP(1)						      General Commands Manual							 LOGTOP(1)

NAME
logtop - Realtime log line rate analyser SYNOPSIS
logtop [OPTIONS] DESCRIPTION
logtop is a System Administrator tool analyzing line rate on stdin. It reads on stdin and print a constantly updated result displaying, in columns: Line number, count, frequency, and the actual line. $ tail -f FILE | logtop is the friendly version of: $ watch 'tail FILE | sort | uniq -c | sort -gr' OPTIONS
-s, --size=K Only keep K lines in memory, instead of 10000. -q, --quiet Do not display a live view of the data, only display a top at exit. -l, --line-by-line=K Print result line by line, in a machine friendly format, K is the number of result to print per line. Line by line format is : [%d %f %s ]* %d : Number of occurences %f : Frequency of apparition %s : String (Control chars replaced by dots. -i, --interval=K Interval between graphical updates, in seconds. Defaults to 1. -h, --help Show summary of options. -v, --version Show version of program. EXAMPLES
Here are some logtop usage examples. tail -f cache.log | grep -o "HIT|MISS" | logtop Realtime hit / miss ratio on some caching software log file. tail -f access.log | cut -d' ' -f1 | logtop -s 10000 Realtime most querying IPs on your server, as long as log lines in access.log starts with the client IP. tail -f access.log | cut -d' ' -f7 | logtop -s 10000 Realtime most requested web pages in a NCSA like log file. cat auth.log | grep -v "CRON" | grep -o ": .*" | logtop -q -s 100000 Display a one-shot simple analyse of your auth.log. SEE ALSO
watch(1) AUTHOR
logtop was written by Julien Palard. This manual page was written by Julien Palard <julien@palard.fr>, for the Debian project (and may be used by others). April 16, 2011 LOGTOP(1)
All times are GMT -4. The time now is 08:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy