archstanton
New Member
I have a variable called $time that contains
1,1708746085,apples,cars
2,1709764378,pears,bus
3,1709875892,orange,truck
Im trying to iterate over the variable and convert the time from unix time to human readable
var=
for secs in $var
do
date -d @$secs
done
But it only seems to convert the 1st occurrence and not all them. Suggestion?
At the end of the day im hoping to append the converted times to the end of the items as the 5th column like
1,170874608,apples,cars,Fri, Mar 15 2024 7:37:39 PM
1,1708746085,apples,cars
2,1709764378,pears,bus
3,1709875892,orange,truck
Im trying to iterate over the variable and convert the time from unix time to human readable
var=
echo $time |awk -F ","' '{print $2}'
for secs in $var
do
date -d @$secs
done
But it only seems to convert the 1st occurrence and not all them. Suggestion?
At the end of the day im hoping to append the converted times to the end of the items as the 5th column like
1,170874608,apples,cars,Fri, Mar 15 2024 7:37:39 PM