08-08-2005
grep numbers range
I want to grep a range of numbers in a log file. My log file looks like this:
20050807070609Z;blah blah
That is a combination of yr,month,date,hours,minutes,seconds.
I want to search in the log file events that happened between a particular time.
like between 20050807070000 to 20050822070000 i.i all events happened between 7thAugust 7am until 22nd August 7am.
I tried with grep but in vain.
Help
Thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi im new to unix and need to find a way to grep the top 5 numbers in a file and put them into another file. For example my file looks like this
abcdef 50000
abcdef 45000
abcdef 40000
abcdef 35000
abcdef 30000
abcdef 25000
abcdef 20000
abcdef 15000
abcdef 10000
and so on...
How can... (1 Reply)
Discussion started by: ProgChick2oo9
1 Replies
2. Shell Programming and Scripting
Howdy experts,
We have some ranges of number which belongs to particual group as below.
GroupNo StartRange EndRange
Group0125 935300 935399
Group2006 935400 935476
937430 937459
Group0324 935477 935549
... (6 Replies)
Discussion started by: thepurple
6 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I have two columns with data that look like this:
Col1 Col2
------ -----
a 1
a 2
a 3
a 4
a 7
a 8
a 9
a 10
a 11
b 6
b 7
b 8
b 9
b 14 (5 Replies)
Discussion started by: Gussifinknottle
5 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I have a column where there are values from 1 to 150.
I want to get the frequency of values in the following ranges:
1-5
6-10
11-15
....
....
....
146-150
How can I do this in a for loop?
Thanks,
Guss (1 Reply)
Discussion started by: Gussifinknottle
1 Replies
5. UNIX for Dummies Questions & Answers
Hi I have a data file with two columns which looks like:
1 42
2 40
3 55
4 50
5 38
6 49
7 33
8 46
9 39
10 33
11 33
12 26
13 46
14 44
15 55
16 54
17 30
18 32 (7 Replies)
Discussion started by: marhuu
7 Replies
6. Shell Programming and Scripting
out of a range of numbers, how can i pick out the number that is the closest to any arbitrary/random number that a user supplies?
say the range of numbers are between 1 - 90000. but that doesn't mean each number exist between 1 - 90000. the range of numbers could be for example:
1, 3, 4, 6,... (6 Replies)
Discussion started by: SkySmart
6 Replies
7. Shell Programming and Scripting
Dear Friends,
I want to know how to grep for the lines that has a number between given range(start and end).
I have tried the following sed command.
sed -n -e '/20030101011442/,/20030101035519/p'
However this requires both start and end to be part of the content being grepped. However... (4 Replies)
Discussion started by: tamil.pamaran
4 Replies
8. UNIX for Dummies Questions & Answers
I am trying to extract specific information from a large *.sam file (it's originally 28Gb).
I want to extract all lines that are on chr3 somewhere in the range of 112,937,439-113,437,438.
Here is a sample line from my file so you can get a feel for what each line looks like:
seq.4 0 ... (8 Replies)
Discussion started by: genGirl23
8 Replies
9. Shell Programming and Scripting
Hi,
I'm trying to match a filename that could be called anything from vout001 to vout252 and was trying to do a small test but I'm not getting the result I thought I would..
Can some one tell me what I'm doing wrong?
*****@********>echo $mynumber ... (4 Replies)
Discussion started by: Jazmania
4 Replies
10. Shell Programming and Scripting
Hi
I am getting an argument which specifies the range of numbers. eg: 7-15
Is there a way that i can easily (avoiding loop) print the range of number between and including the specified above.
The above example should translate to 7,8,9,10,11,12,13,14,15 (3 Replies)
Discussion started by: tostay2003
3 Replies
LAST(1) BSD General Commands Manual LAST(1)
NAME
last -- indicate last logins of users and ttys
SYNOPSIS
last [-swy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host] [-n maxrec] [-t tty] [user ...]
DESCRIPTION
The last utility will either list the sessions of specified users, ttys, and hosts, in reverse time order, or list the users logged in at a
specified date and time. Each line of output contains the user name, the tty from which the session was conducted, any hostname, the start
and stop times for the session, and the duration of the session. If the session is still continuing or was cut short by a crash or shutdown,
last will so indicate.
The following options are available:
-d date Specify the snapshot date and time. All users logged in at the snapshot date and time will be reported. This may be used with
the -f option to derive the results from stored utx.log files. When this argument is provided, all other options except for -f
and -n are ignored. The argument should be in the form [[CC]YY][MMDD]hhmm[.SS] where each pair of letters represents the follow-
ing:
CC The first two digits of the year (the century).
YY The second two digits of the year. If YY is specified, but CC is not, a value for YY between 69 and 99 results in
a CC value of 19. Otherwise, a CC value of 20 is used.
MM Month of the year, from 1 to 12.
DD Day of the month, from 1 to 31.
hh Hour of the day, from 0 to 23.
mm Minute of the hour, from 0 to 59.
SS Second of the minute, from 0 to 61.
If the CC and YY letter pairs are not specified, the values default to the current year. If the SS letter pair is not specified,
the value defaults to 0.
-f file Read the file file instead of the default, /var/log/utx.log.
-h host Host names may be names or internet numbers.
-n maxrec Limit the report to maxrec lines.
-s Report the duration of the login session in seconds, instead of the default days, hours and minutes.
-t tty Specify the tty. Tty names may be given fully or abbreviated, for example, ``last -t 03'' is equivalent to ``last -t tty03''.
-w Widen the duration field to show seconds, as well as the default days, hours and minutes.
-y Report the year in the session start time.
If multiple arguments are given, and a snapshot time is not specified, the information which applies to any of the arguments is printed,
e.g., ``last root -t console'' would list all of ``root's'' sessions as well as all sessions on the console terminal. If no users, hostnames
or terminals are specified, last prints a record of all logins and logouts.
The pseudo-user reboot logs in at reboots of the system, thus ``last reboot'' will give an indication of mean time between reboot.
If last is interrupted, it indicates to what date the search has progressed. If interrupted with a quit signal last indicates how far the
search has progressed and then continues.
FILES
/var/log/utx.log login data base
SEE ALSO
lastcomm(1), getutxent(3), ac(8), lastlogin(8)
HISTORY
A last utility appeared in 3.0BSD.
BUGS
If a login shell should terminate abnormally for some reason, it is likely that a logout record will not be written to the utx.log file. In
this case, last will indicate the logout time as "shutdown".
BSD
January 21, 2010 BSD