![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare date from db2 table to yesterday's Unix system date | sasaliasim | Shell Programming and Scripting | 9 | 2 Days Ago 08:37 PM |
| option followed by : taking next option if argument missing with getopts | gurukottur | Shell Programming and Scripting | 2 | 03-17-2008 09:46 AM |
| I want to get day from the current system date | gopskrish | UNIX for Dummies Questions & Answers | 2 | 06-24-2005 06:52 AM |
| system date | Prafulla | UNIX for Dummies Questions & Answers | 1 | 02-01-2002 03:42 AM |
| file date vs. system date | ober5861 | UNIX for Dummies Questions & Answers | 8 | 09-11-2001 11:36 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
awk system date with -d option
Hi
I get problems when using the following command : Code:
cat logs | awk -F";" '{ system("date -d "1970-01-01 UTC+0100 $1 seconds""); }'
date: date invalide `1968641199401200'
date: date invalide `1968641199381709'
Code:
cat logs 1199401200;a 1199381709;b Any idea ? Thx Last edited by arag0rn; 01-05-2008 at 08:48 AM. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
while IFS=";" read a b
do
date -d "1970-01-01 UTC+0100 $a seconds"
done < file
|
|
#3
|
||||
|
||||
|
Thanx but This is not what i want to do
thx for this idea but it does not work for me
I made something that gives the same output your code should give but this is not what i am searching for : Code:
for mytimestamp in $(cat logs| awk -F";" '{ print $1; }'); do echo $(date -d “1970-01-01 UTC+0100 $mytimestamp seconds”); done
Last edited by arag0rn; 01-05-2008 at 08:49 AM. |
|
#4
|
|||
|
|||
|
If you have GAWK you can use the strftime function or you can fit the script of gostdog74 like:
Code:
while IFS=";" read a b
do
echo $(date -d "1970-01-01 UTC+0100 $a seconds")";"$b
done < file
|
|||
| Google The UNIX and Linux Forums |