Converting a date to friday date and finding Min/Max date
Dear all,
I have 2 questions.
I have a file with many rows which has date of the format YYYYMMDD.
1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too.
2. After converting the date to friday date, The Minimum and maximum dates has to be derived.
Please post the expected output to match your input.
What does "next week friday date" mean? Please explain.
I took it to mean July 28th to be rounded up to August 3rd.
I put those julian date functions into awk, since awk seems to work the same everywhere no matter your shell.
It is a bit lengthy. If only output you want is that next friday, there are day-of-week algorithm that wouldn't require converting to-and-from julian. You could use sort -n on that column and grab the first and last, then depends on OS if you can use date -d to get next friday...
This is bash function for day of week, since GNU date did allow "next friday" but not "2012-07-27 next friday"
could then just add days yourself until it is friday (like next_friday i wrote in awk)
This User Gave Thanks to neutronscott For This Post:
Have you found a way to incorporate these suggestions into what you need, or do you need more help? If a clear complete sample of input (3 lines maybe) and exact output is given, a complete working example would be more probable.
Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt .
I don't want to delete... (2 Replies)
i try to set linux date & time in specific format but it keep giving me error
Example :
date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
or
date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
keep giving me this error :
date: invalid date ‘19-01-2017 00:05:01'
Please use CODE tags... (7 Replies)
Hi,
I have a string date to my unix script(sun solaris). I wanted to convert it into unix date so that I can use it in a conditional statement. Please see below:
MyTest.sh -s 2018-05-09
suppdt=$1 # string date passed via arguement as 2018-04-09
curryr=`date '+%Y'`
nextyr=`expr... (2 Replies)
hi there
I have file names in different format as below
triss_20111117_fxcb.csv
triss_fxcb_20111117.csv
xpnl_hypo_reu_miplvdone_11172011.csv
xpnl_hypo_reu_miplvdone_11-17-2011.csv
xpnl_hypo_reu_miplvdone_20111117.csv
xpnl_hypo_reu_miplvdone_20111117xfb.csv... (10 Replies)
I want to get maximum/minimum date/timestamp from a data file ?
Sample Input File
=============
rec#,order_dt,ext_ts
1,2010-12-01,2010-12-01 17:55:23.222222
2,2011-11-05,2010-12-01 19:55:23.222222
3,2009-10-01,2010-12-01 18:55:23.222222
for above file
Maximum Order_dt = 2011-11-05... (5 Replies)
Hi guys,
I had a scenario...
1. I had to get the previous days date in yyyymmdd format
2. i had to create a file with Date inthe format yyyymmdd.txt format
both are different
thanks guys in advance.. (4 Replies)
Hi all,
I've used various scripts in the past to work out the date last week from the current date, however I now have a need to work out the date 1 week from a given date.
So for example, if I have a date of the 23rd July 2010, I would like a script that can work out that one week back was... (4 Replies)
Hi,
I have a requirement where I want to get the date of monday when I am running the script from previous Friday to the following Thursday.
For example: When ever I run the script between 19thFeb2010(Friday) to 25th Feb 2010(Thursday), I should get the date of 22nd Feb 2010 in the format of... (5 Replies)
Hi all!
I'm working on a HPUX system, and I was wondering if there is a simple way to convert a date from seconds (since 1970) to a normal date.
Thanks (2 Replies)