Results 1 to 6 of 6
Hi All,
I need to calculate time period spent. The Start and End time are available in a file:
#cat trna.3000_3010.time
Tue Dec 25 11:10:25 IST 2007
Tue Dec 25 ...
- 01-08-2008 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 13
script to calculate time spent
Hi All,
I need to calculate time period spent. The Start and End time are available in a file:
#cat trna.3000_3010.time
Tue Dec 25 11:10:25 IST 2007
Tue Dec 25 12:40:07 IST 2007
I did the following to get "seconds" numbers as follows.
# cat trna.3000_3010.time | cut -d " " -f 4 | cut -d : -f 3
25
07
Now I'm not getting, how to get these numbers(25, 07) individually and to store these in a variable.
Can any one tell how to do this?
- Sangamesh
- 01-08-2008 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
- 01-08-2008 #3Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
- 01-08-2008 #4Linux User
- Join Date
- Aug 2006
- Posts
- 458
- 01-08-2008 #5Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
- 01-08-2008 #6Linux User
- Join Date
- Aug 2006
- Posts
- 458
no worries
noted. I would use awk for myself if I have this problem, however I would rather show bash and its useful features to OP without the use of cut/sed/awk (for this purpose), just for OP to get the feel of bash.
Code:while read -a line do echo ${line[3]##*:} done < "file"


Reply With Quote
