Thanks, but I think you missed the point of my post. I need to convert the date that is contained in the file, in to a day of the week. I do not need to know the current day of the week according to the system.
Did you try running the suggestion Chubler_XL suggested before saying it won't work? His code won't print the current day's day of week, it will either give you a diagnostic saying that the date utility doesn't recognize a --date option, or it will do what you requested.
What OS are you using?
Maybe I don't understand what you're trying to do. You said you want the output:
July 1, 2014 was a Tuesday; not a Monday.
June 26, 2014 was a Thursday; not a Wednesday.
June 27, 2014 was a Friday; not a Tuesday.
And, July 2, 2014 was a Wednesday; not a Friday and a Saturday???
Did you try running the suggestion Chubler_XL suggested before saying it won't work? His code won't print the current day's day of week, it will either give you a diagnostic saying that the date utility doesn't recognize a --date option, or it will do what you requested.
What OS are you using?
Maybe I don't understand what you're trying to do. You said you want the output:
July 1, 2014 was a Tuesday; not a Monday.
June 26, 2014 was a Thursday; not a Wednesday.
June 27, 2014 was a Friday; not a Tuesday.
And, July 2, 2014 was a Wednesday; not a Friday and a Saturday???
Firstly, if I sounded dismissive I certainly did not intend my post to appear so, I genuinely appreciate people sharing their experience freely with novices like myself. So Chubler_XL if my post came across as offensive then I sincerely apologise.
No, I did not try the example, I read it with my unqualified skill level and assumed it would simply return todays date. I should have actually taken the time to type this in to the terminal, when I did, it indeed returned what I needed.
As for the erroneous data in my post, I simply hand typed some days against the original data, that is the reason the days chosen do not match the actual dates, it was purely for illustration purposes.
Again thank you to everyone for you assistance, and apologies for my incorrect assumptions. Lesson learned, when you don't know what you are talking about (that's me!), it's best to shut up
No, I did not try the example, I read it with my unqualified skill level and assumed it would simply return todays date. I should have actually taken the time to type this in to the terminal, when I did, it indeed returned what I needed.
... ... ...
Again thank you to everyone for you assistance, and apologies for my incorrect assumptions. Lesson learned, when you don't know what you are talking about (that's me!), it's best to shut up
We don't want you to shut up. We want you to learn. When you ask a question, and you get one or more suggestions; if you don't understand what it does:
try it, or
look at the man page for the suggested utility to see what it should do, or
both.
And then:
report back to us what happened,
thank people who gave you working suggestions, or
explain what you got and how that was different from what you were trying to do.
And, if you got something that works, but you can't figure out how it works, ask questions. Most of the volunteers who make suggestions here are happy to explain what their (or someone else's) code does. We want to help you learn how to make the most out of the tools that are available to you.
And, for other people reading this thread. If you wanted to do something like what was requested here on a system that doesn't have gawk and has a date utility that doesn't support the --date option, but you do have access to a 1993 or later version of the Korn shell (such as on Mac OS/X), you could also try:
which with the given sample input file produces:
This User Gave Thanks to Don Cragun For This Post:
Hi All,
I have the below requirement ,
if i give the week number for ex 41 i need to get the date for Monday and thursday for this given week. my expected output is 13/10/2014 (Monday's date) and 16/10/2014 (Thursday's date)
I am using GNU LINUX .
Pls help me with your thoughts.
Thanks in... (7 Replies)
I have been volunteered by my boss to be the sysadmin for our production redhat server. He asked me to tighten the security to avoid mishaps like "rm -f *" that occured not long ago.
Right now, we have 53 users sudo-ing into the machine and it is an audit nightmare. I am wondering if it... (15 Replies)
In HP-UX the date command does not have the "-d" switch like some other *nixes do. I'm working a simple script to tell me, given the day, month and year what day of the week that falls on.
Assuming valid day, month and year input (I'd perform quality checks on the input separately, but not... (5 Replies)
Hi All,
I have date in string format 'YYYY-MM-DD'. I want to know day of the week for this date.
Example. For '2005-08-21' my script should return '0' or Sunday
For '2005-08-22' it should return '1' or Monday
I want piece of code for HP-UX korn shell.
Appreciate reply on this. (5 Replies)
How to find the Day of the Week of the given Date using perl?
If I have a date in YYY--MM-DD format, how to find the DOW? Based on that, I need to find the following sunday.
Pls help. (5 Replies)
Hi All,
Our system is running on Solaris 8 and we are using US locale. By default the First Day Of Week is Sunday, is it possible for us to change it to Monday?
I have googled it but found very little of use.
THanks in advance. (2 Replies)
I need o get yesterday's day of week but im not exactly sure. the actual name is what i want. I can do it with numbers but im not sure with words. (3 Replies)
Hi ,
I am working at Unix system,using c lang.
I need c fun which return the day of the week .
For example :
0- Sunday.
1- Monday.
....
10x. (4 Replies)