Selecting certain times from a list


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Selecting certain times from a list
# 1  
Old 05-04-2009
Selecting certain times from a list

Hi all,

I have a list of times:
Code:
...10:02
15:34
20:05
01:51
06:55
09:00
05:52...

That's just part of the list (its huge).

How do I go about selecting certain times, e.g. just between 23:00 and 05:00 ??
# 2  
Old 05-05-2009
Code:
awk -F: '$1 < 5 || $1 > 22' huge.file

# 3  
Old 05-05-2009
Sorry, it was late last night, and I wasn't being very clear. (I actually posted the entire wrong situation).

In that file there is a column with a list of times (as above), and various other columns, username, ipaddress etc... (example below)

Code:
... USER1 10:58 10.0.0.5 BASH
USER2 21:55 10.0.0.85 BASH...

so on and so forth... I only want to show the lines with a time greater than 22:00 (i.e. 22:00 - 23:59) and less than 05:00 (i.e. 00:00 - 05:00).

Hope this makes it clearer
# 4  
Old 05-05-2009
how do you know that 00:00 to 05:00 is the time next day or the time that is today? does your file have the date as well??
# 5  
Old 05-05-2009
urm... it doesnt at the min however i could awk in the date aswell if that would help
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding a List of Times

Hey gang, I have a list of times I need to sum up. This list can vary from a few to a few thousand entries. Now I had found a closed reference to adding time titled "add up time with xx:yy format in bash how?" In it, the example works great for that formatted list of times... This is the reply code... (5 Replies)
Discussion started by: Brusimm
5 Replies

2. Shell Programming and Scripting

List the file names available on FTP server before selecting the required file

Below is my script code.which shows the environment name and then fetch the file from the ftp server but I am facing one issue.The script should be run in both way.We can pass the arguments with script and select the environment name then file name.Here the issue is I am not able to list the files... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies

3. Shell Programming and Scripting

Selecting tables

Hi, Can anyone help me that, How to see the table fields in Oracle database through shell script(ksh). I have tried with the following: sqlplus -s $user/$passwd@$sid << SQL >> session.log select * from Testtab.sql I'm not able to see anything.. Thanks (4 Replies)
Discussion started by: zxcjggu708
4 Replies

4. Shell Programming and Scripting

selecting certain files

Hi, I have been working on a punch of codes and I got to a problem I hope to get help on. I have some files that I want to work with but the folder has other files in it. For example: The folder contains these files: path to files: /home/distribution/ ls: b.10; b.11; b.12; b.20; b.222;... (2 Replies)
Discussion started by: iconig
2 Replies

5. Shell Programming and Scripting

Selecting files from a list and passing them to a program using csh

I have a list of files, example as shown below n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf... (8 Replies)
Discussion started by: kristinu
8 Replies

6. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

7. UNIX for Dummies Questions & Answers

Selecting Unique Values from many List

I have a question I have like 19 different list which contains the name of the server but what I need is just unique ones. First thing I need to do is just make a unique list within the list itself i.e. delete anything that is repeated inside the list like for example in list1 i... (1 Reply)
Discussion started by: pareshan
1 Replies

8. AIX

how would you know your server was rebooted 3 times or 5 times

Is there such location or command to know how many times did you reboot your server in that particular day?in AIX. (3 Replies)
Discussion started by: kenshinhimura
3 Replies

9. Shell Programming and Scripting

Selecting one file from a list

Hi, I am able to do this by brute force but I am just curious if there is a better way of handling things. Basically the scenario is something like this: There are a number of files in a directory: rib.20071224.1759.gz 24-Dec-2007 17:59 132K rib.20071224.1959.gz 24-Dec-2007... (7 Replies)
Discussion started by: Legend986
7 Replies

10. Shell Programming and Scripting

Selecting a line value

Hello, I just wanted to know if there is a way in UNIX to select a line value from a list of words. there is no line number before each word, hence could not use grep. (4 Replies)
Discussion started by: unibboy
4 Replies
Login or Register to Ask a Question