Display data from a range of dates


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Display data from a range of dates
# 1  
Old 01-01-2013
Linux Display data from a range of dates

I have a data in a file called SCHED which has 5 columns: sched no, date, time, place and remarks. The image is shown below.

Image

Now, I want to display only the schedules which fall under a certain date range which the user has to input. For example the start date is 21/12/2012 and the end date is 03/01/2013, the output should then be the first 3 records because they fall under that range.

btw, i am using a dialog utility for the calendar so when i select a date, its format is automatically dd/mm/yyyy. This is how i assigned the selected date to a variable:

Code:
USERDATE=`dialog --nocancel --stdout --title "My Calendar"  --calendar "Select a date:" 0 0 -1 -1 -1`

that and the other data like sched no, time, place and remarks go to a file called SCHED.
Any idea on how I can do this? I basically have no idea on how I am going to compare the user input (start date and end date) to the dates on the file. Please help me. I am a newbie shell script programmer.
# 2  
Old 01-01-2013
Pls use textual representation of your file and code tags for your sample. What system (HW, OS) are you on?

Last edited by RudiC; 01-02-2013 at 04:54 AM..
# 3  
Old 01-01-2013
Can you show the actual sched file? Not a pasted image of the file? Hard to do anything without the actual raw file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display dates between two dates

Hi All, I have 2 dates in mm/dd format. sdate=10/01 (October 01) edate=10/10 (October 10) I need the dates in between these 2 dates like below. 10/01 10/02 10/03 10/04 10/05 10/06 10/07 10/08 (1 Reply)
Discussion started by: jayadanabalan
1 Replies

2. Shell Programming and Scripting

Display files within a range

My script reads all the log files in a directory, the user would enter a range and the script would only display the files within those range. Here's my code: #!/bin/bash LOG_FILES=("Sandbox/logs/*") for file in ${LOG_FILES}; do echo $file; done ------------- for i in $(seq $1 $2); do... (1 Reply)
Discussion started by: Loc
1 Replies

3. Shell Programming and Scripting

Display previous days dates in ksh

---------- Post updated at 03:42 AM ---------- Previous update was at 03:38 AM ---------- Sorry for a duplicate post, my post at the first place could not appear due to some net issue on my machine. Here is what i posted earlier: Hi, i am using ksh in Solaris, i wanted to assign today's,... (5 Replies)
Discussion started by: pr5439
5 Replies

4. Emergency UNIX and Linux Support

show div on select - range of dates

Hi, I am sure this is simple, but I am breaking my head. I need 1 page with at the top a range of dates, 2002, 2003, 2004 etc If you select 2002 it will show the content of 1 div, if you select 2002 the content of another div. this is for showing announcements on a site, right now there... (1 Reply)
Discussion started by: lawstudent
1 Replies

5. Shell Programming and Scripting

Using 'date' to list a range of dates

Hi guys, I have been trying to create a list of dates from a certain range, ie. range from 01011950 to 31122000 But when my below code reaches certain dates, it comes up with a; 'date: invalid date 'yyyy-mm-dd -d 1day' Sofar I have come up with the following, slow and ugly; ... (4 Replies)
Discussion started by: TAPE
4 Replies

6. Shell Programming and Scripting

pull range of dates/times and put into new file

Need to pull from a range of dates/times (ex. 6:00 AM March 3 through 6:00 AM March 4) from a folder and put those file names in a new file to process later. Dates would not be hard dates but dates from the folder directory, how would I do that? (9 Replies)
Discussion started by: freddie999
9 Replies

7. Shell Programming and Scripting

Display the last five dates from the given date

Hi all, In Oracle we have got sysdate -1 to find the previous date. Is there any similar way to display date in unix shell scripting? Kindly help me to display the last five dates from the given date Thanks, Geetha (11 Replies)
Discussion started by: iamgeethuj
11 Replies

8. Shell Programming and Scripting

display all dates 200 days back

i need help! can someone help me please? i try to calculate date under unix (ksh)...AIX operating system. I have to find the date 200 days from today's date. then the script should loop 200 times and display on command line every day's date until the current date. example: todays date:... (4 Replies)
Discussion started by: pavan_test
4 Replies

9. UNIX for Dummies Questions & Answers

display all dates 200 days back

i need help! can someone help me please? i try to calculate date under unix (ksh)...AIX operating system. I have to find the date 200 days from today's date. then the script should loop 200 times and display on command line every day's date until the current date. example: todays date:... (1 Reply)
Discussion started by: pavan_test
1 Replies

10. UNIX for Dummies Questions & Answers

Display dates within a given date range

Hi All, I have a requirement to display all the dates within the provided (through user input) date range. For eg: If I enter 28012009 (as From date in the format 'DDMMYYYY') and 02022009(as To date in the format 'DDMMYYYY'), the output should be all dates occuring between the from and to... (11 Replies)
Discussion started by: sunpraveen
11 Replies
Login or Register to Ask a Question