Red Hat - ouput capture


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Red Hat - ouput capture
# 1  
Old 04-09-2003
Red Hat - ouput capture

Red Hat 7.2

On command line.. i need to ouput or capture just..

CPE3236313839393 Fri Nov 1 00:05 - 00:05 (00:00)

the time inside the brackets (00:00) ... i havea list of about a hundred from sperate dates in a long file.

I need to some how grep or i dunno all times from Nov 1 and get the total time for a spread sheet.

Anyone know how??
# 2  
Old 04-10-2003
Not sure if you want a total or to just get a list of time for Nov 1 so here are both.

To get a total from command line:

# grep "Nov 1" yourfile.txt | wc -l

Don't think that is what you want, but just in case.

To get each instance:

# grep "Nov 1" yourfile.txt | awk -F\( '{print $2}' | sed 's/)//g'
# 3  
Old 04-10-2003
Quote:
Originally posted by TioTony
Not sure if you want a total or to just get a list of time for Nov 1 so here are both.

To get a total from command line:

# grep "Nov 1" yourfile.txt | wc -l

Don't think that is what you want, but just in case.

To get each instance:

# grep "Nov 1" yourfile.txt | awk -F\( '{print $2}' | sed 's/)//g'
Will that get just the times from any line that has Nov 1??

And how do i output that? just > file.txt at the end?
# 4  
Old 04-10-2003
I took it a step further to actually add up the times in case you want to use the total:
Code:
totHr=0
totMn=0

times=`grep "Nov 1" a | awk -F\( '{print $2}' | sed 's/)//g'`
for tm in $times
do
  tmp=`echo $tm | awk '{ print substr($0,1,2) }'`
  totHr=`expr $totHr + $tmp`

  tmp=`echo $tm | awk '{ print substr($0,4,2) }'`
  totMn=`expr $totMn + $tmp`
done

totHr=`expr $totHr + $totMn / 60`
totMn=`expr $totMn % 60`

echo $totHr "hrs," $totMn "min"

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to know if i use "Red Hat Enterprise Linux" or "Red Hat Desktop" ?

how to know if i use "Red Hat Enterprise Linux" or "Red Hat Desktop" ? (2 Replies)
Discussion started by: ahmedamer12
2 Replies

2. Linux

'route get' for Red Hat

Hi everyone, I've always used the 'route get hostname/ip' function in Solaris to test whether routing is setup correctly for particular hosts. The 'get' switch doesn't seem to be available for Red Hat. Can anyone offer a suitable alternative? Many thanks. ---------- Post updated at... (0 Replies)
Discussion started by: badoshi
0 Replies

3. Red Hat

Red-hat

Hello, How do I see what IP addresses are connected to my machine? thanks (2 Replies)
Discussion started by: sonomao
2 Replies

4. Red Hat

Red Hat E 3

I'm am working with a Red Hat Enterprise 3 server. This is a dedicated server that is supposedly dedicated to one domain, but I have been tasked with trying to figure out if there are files on this system that are being accessed by other IP's. Does anyone know if how I would go about finding... (0 Replies)
Discussion started by: chrisPlusPlus
0 Replies

5. Linux

red hat ee 2.6.9-42

hello. I would be greatfull if someone could tell me how will i see what dns server and gateway my red hat server uses. I tryied to find out by typing ifconfig command but i got : -bash: ifconfig: command not found , although man ifonconfig gives output with info about using that command. Is... (3 Replies)
Discussion started by: tonijel
3 Replies

6. Shell Programming and Scripting

capture the ouput!

Hi, my perl script is calling another external java program. The Java in turn prints out a string. how can I capture the string. ------------------ #!/usr/bin/perl print "Content-type:text/html\n\n"; use CGI; $query = new CGI; $theCookie = $query->cookie('someCookie'); $user =... (0 Replies)
Discussion started by: azmathshaikh
0 Replies

7. UNIX for Dummies Questions & Answers

Red Hat 9 help

please help me how to install softwares in linux.i have a ethernet internet connection.i try to open the site on LAN to download internet client.but i cannot as our lan supports only internet explorer....i downloaded the linux client by booting thru XP......but i cannot c my NTFS partition thru... (0 Replies)
Discussion started by: shobhit143
0 Replies

8. Linux

Red Hat?

I have a Red Hat upgrade disk. I installed it and it corrupted my entire hard drive! I had gotten the disks out of a Dummy's book at my local library. Trying to install 'Red Hat', has cost me $100.00 in damages. (The cool part is my friend gave me that $100.00 part) Ah...A 120gig Hard Drive. Just... (3 Replies)
Discussion started by: hdk_mkr
3 Replies

9. UNIX for Dummies Questions & Answers

Red Hat 7.2.....

I just installed red hat 7.2 on my laptop. it's dual booted with xp and red hat. when i boot in to linux it boots up to the screen to ask me my name and pass....i put in root and my password. after this it goes to a blue screen and sits there. the after about 2 minutes it comes up with a fatal... (1 Reply)
Discussion started by: muzscman
1 Replies
Login or Register to Ask a Question