I'm not sure why you are starting another thread to discuss what seems to be the same issue, but apparently in this thread the data you're looking for is in the first field on lines in your data instead of the last field.
As has been said before, providing sample input data (in CODE tags), desired output from that sample input (in CODE tags), and a clear statement of what shell and operating system you're using (including version numbers) would make it much easier to help you.
Does the version of HP-UX you're using have a ksh93 utility? If so, what output do you get from running the command:
printf '%(%s %Y-%m-%d %H:%M:%S)T\n'
in that shell?
If you don't have a ksh93 utility, what do you get if you run that command when using ksh as your shell?
Note that your problem has absolutely nothing to do with awk ; the errors you are getting are from the date utility.
printf: Error processing format
printf: Error processing format
printf: Error processing format
printf: Error processing format
printf: Error processing format
printf: Error processing format
@Bakunin: that looks like a neat trick. It does not seem to work on HP-UX, however (max 24 hours)...
It appears to only work on AIX and IRIX to the full extent.
I found the following maximum time shifts using the date utility with the TZ variable...
AIX: Works (No limit)
IRIX: Works (No Limit)
Tru64: Max. 7 days
Solaris: Max. 7 days (using /usr/xpg4/bin/date)
MacOS: Max. 7 days
HP-UX: Max. 1 day
Linux: Max. 1 day
Of course on Linux one would not need the trick since it has GNU date...
If one were to create a sample input file named myname.dat containing:
2018-12-24'0 days ago
2018-12-17'7 days ago
2018-12-10'14 days ago
2018-12-03'21 days ago
2018-11-26'28 days ago
2018-11-25'29 days ago
2018-11-24'30 days ago
2018-11-23'31 days ago
2018-11-22'32 days ago
2018-11-21'33 days ago
2018-11-20'34 days ago
2018-11-19'35 days ago
2018-11-12'42 days ago
2018-11-05'49 days ago
and one were to create a utility named now-30days from the C source file now-30days.c :
if run in the directory containing myname.dat might produce the output:
2018-11-23'31 days ago
2018-11-22'32 days ago
2018-11-21'33 days ago
2018-11-20'34 days ago
2018-11-19'35 days ago
2018-11-12'42 days ago
2018-11-05'49 days ago
if that command were run on December 24, 2018 (like I did here a few minutes ago).
Is this what you were trying to do?
I don't believe there is anything in this that is not available on all UNIX (including HP-UX), BSD, and Linux systems. It should do some error checking on the returns from localtime() , printf() , and strftime() , but this might give you a starting point for whatever you're trying to do.
There is an option in ksh to change the behaviour of ksh to accept latest posix ( or some ksh93 if not all... but no ways for me to test no more HP-UX...) e.g.
UNIX95= ps -e -o pid,comm,pcpu|more
So you can always try UNIX95=... and your options, I suggest you have a look at the man pages as I cant having no more access...