The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Need help in changing Mod time of a file ali560045 Shell Programming and Scripting 6 09-23-2008 02:45 AM
Changing what time a process thinks it is with libfaketime iBot UNIX and Linux RSS News 0 09-22-2008 11:10 AM
changing modified time ali560045 Shell Programming and Scripting 1 06-12-2008 05:55 AM
[help] changing time on solaris 8 sparc bucci SUN Solaris 2 07-25-2007 11:17 PM
How to MV without changing Time Stamp redlotus72 UNIX for Dummies Questions & Answers 3 07-15-2005 06:16 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-29-2008
suri.tyson suri.tyson is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 20
Changing the output in own time display's.

Hi all, I've written a script which collects some information and sendsout a mail.. (code pasted below)

ssh -l ora${sid} ${primaryhost} "tail -50 /oracle/$ORACLE_SID/newbackup/END_BACKUP.log" |grep 'insert' |tail -1| awk '{print $7}' >> ${RESULTFILE}

Output would look like this: ('20080920212141','net','Q05','DB','0','20080921064023','netbackup','netbackup')

Now i want to display only the time start & end time with return code "0" in the middle of the line as one of the format below.

2008/09/20/ 21:21:41
Sat Sep 20 21:21:41

How do i do this..?

And in the script am greping for word 'insert' and taking the last line and again doing Print $7.. do this am able to get the whole things which is in (******)... but i dont want all the information.

Can someone please help me how to do this..

Thanks in advance..
  #2 (permalink)  
Old 09-29-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,864
Smile

Quote:
Originally Posted by suri.tyson View Post
Output would look like this: ('20080920212141','net','Q05','DB','0','20080921064023','netbackup','netbackup')

Now i want to display only the time start & end time with return code "0" in the middle of the line as one of the format below.

2008/09/20/ 21:21:41
Pipe the last line through sed:
Code:
sed 's/\([0-9][0-9][0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\)/\1\/\2\/\3 \4:\5:\6/'
Quote:
And in the script am greping for word 'insert' and taking the last line and again doing Print $7.. do this am able to get the whole things which is in (******)... but i dont want all the information.
Change to :
Quote:
| awk '/insert/ { print $7 }' |tail -1 |sed (see above) >> ${RESULTFILE}
Sponsored Links
Closed Thread

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 08:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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