experts I have three column data(date, timing, extrainfo
) saved in a text file named inputdata.file.
In a loop i want to read the data row wise and want to print the yearjulianday from the first column data.
secondly for the second column data I want to print the output in hour minute second
format but here i want to minus 60
seconds and want to rewrite the output in same hour
minute second
format.Additionally, I donot want to do any operation on third column.
For example In the below attached data the first row contains 2019-01-02 07:41:26.225000 5.49.
From this data at first i just want to convert 2019-01-02 to 2019+its julian day i.e. 2019002.
secondly 07:41:26.225000 should be converted to same hr:min:sec format after deduction of 60 seconds i.e 07:40:26.225000 .Similarly for other rows i want to do the same.
2019-01-02 07:41:26.225000 5.49
2019-01-05 19:43:54.185000 5
2019-01-07 19:05:21.165000 5.18
expected output
2019-01-02 07:41:26.225000 5.49 2019002 07:40:26.225000
2019-01-05 19:43:54.185000 5 2019005 19:42:54.185000
2019-01-07 19:05:21.165000 5.18 2019007 19:04:21.165000
I tried the script as :
while read -r line;
do
echo "$line" ;
awk '{print $1}'
done < inputdata.file
However as i am new to shell scripting, not getting much idea on this.Please help.Thanks.