![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can i read a non text file in unix - ELF-64 executable object file - IA64 | alexcol | UNIX for Advanced & Expert Users | 8 | 11-07-2008 08:56 AM |
| Post Shell programming: Question about source a file and read data from the file | ccwq | Shell Programming and Scripting | 3 | 08-04-2007 11:28 PM |
| Read words from file and create new file using K-shell. | bsrajirs | Shell Programming and Scripting | 4 | 06-01-2007 01:15 PM |
| Read xml file | ram2s2001 | Shell Programming and Scripting | 2 | 12-12-2005 12:20 AM |
| How to read specific lines in a bulk file using C file Programming | rajan_ka1 | High Level Programming | 10 | 11-10-2005 03:29 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Help with awk - read from file
Hi, I've got a file like the following: Code:
Starting to process segment 0 (and symmetry related segments) Number of (cancelled) singularities: 0 Number of (cancelled) negative numerators: 0 Segment 0: 5.49secs Starting to process segment 1 (and symmetry related segments) Number of (cancelled) singularities: 0 Number of (cancelled) negative numerators: 0 Segment 1: 10.01secs Starting to process segment 2 (and symmetry related segments) Number of (cancelled) singularities: 0 Number of (cancelled) negative numerators: 0 Segment 2: 7.82secs Starting to process segment 3 (and symmetry related segments) Number of (cancelled) singularities: 0 Number of (cancelled) negative numerators: 0 Segment 3: 5.31secs ... and I would like to extract the information about the time. I would like to read the file, save the time (of each line) to a variable, remove the suffix secs and then add it to the previous value. The result will be the total time.... I tried many things but none of them works... In case it helps, the last one I tried was Code:
TIME="`awk '/Segment/ {print $3%secs + $TIME} ' log.txt`"
echo $TIME
It's a silly solution, but I think it may convey what I want to do.... I suspect that it has something to do with reading each line separetely, but I can't figure it out... Thanks a lot in advance... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|