The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-25-2008
giorgos193 giorgos193 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 17
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0