I am currently trying to convert a GMT time into Unix Epoch time. The overall script reads in a CSV file, which has a time stamp, converts it and then appends the Epoch time to the end of the line as a new variable.
I looked a number of posts and read the web page on DATE http://www.linuxmanpages.com/man1/date.1.php and would have assumed that this would work.
#!/bin/bash
OLDIFS=$IFS
IFS=","
cat test.csv | while read Host AName Resource MName TimeStamp Integer_Value;
do
Epoch=date -d "$TimeStamp" +%s
echo "Host: $Host, Name: $AName, Resource: $Resourse, MName: $MName, TimeStamp: $TimeStamp, Integer_Value: $Integer_Value, Epoch: $Epoch";
done
When this is run though the script it says that the -d command isn't found I was wondering if someone would be able to help me as to why this might be.