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
Output format - comparison with I/p file velappangs Shell Programming and Scripting 1 04-03-2008 06:31 AM
File Format issue: Output of sqlplus deepakgang UNIX for Dummies Questions & Answers 2 10-25-2007 03:56 AM
[need help] output format from awk bucci Shell Programming and Scripting 6 02-09-2007 04:41 AM
Output in a particular format using AWK Raynon Shell Programming and Scripting 4 01-24-2007 04:07 AM
ls output format tonyt UNIX for Dummies Questions & Answers 6 11-23-2001 11:31 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-24-2006
getdpg getdpg is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 72
Format the output of file

hello all

Script and example of file
#!/bin/sh
#sh gdata.sh /users/testsuite/db/appl/

DATE=`date '+20%y-%m-%d'`
echo $DATE
for i in ${1}/$DATE/* ; do
find $i -name daily -prune -o -name run.log -print -exec grep -c ! {} \; done > test.log.


The test.log contains output like this

/users/testsuite/db/appl/2006-01-24/Devel/Sun/run.log
19
/users/testsuite/db/appl/2006-01-24/Devel/Linus/run.log
20
/users/testsuite/db/appl/2006-01-24/9/Sun/run.log
10
/users/testsuite/db/appl/2006-01-24/8/Sun/run.log
19

But i want to cut and format my file like this

Date : 2006-01-24

Version Host Fails
Devel Sun 19
Devel Linu 20
9 Sun 10
8 Sun 19


Please help me to modify this script
. I have to show this staticts on web . Thanks a lot
  #2 (permalink)  
Old 01-24-2006
mahendramahendr mahendramahendr is offline Forum Advisor  
Registered User
  
 

Join Date: Dec 2005
Location: London
Posts: 222
$cat test.log | paste - - | tr "/" " " | cut -d" " -f7,8,10
Devel Sun 19
Devel Linus 20
9 Sun 10
8 Sun 19
  #3 (permalink)  
Old 01-24-2006
getdpg getdpg is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 72
it is not working
error is cut :invalide delimiter ..

pls help me
  #4 (permalink)  
Old 01-24-2006
mahendramahendr mahendramahendr is offline Forum Advisor  
Registered User
  
 

Join Date: Dec 2005
Location: London
Posts: 222
can you copy and post what you have typed here....
space is a valid delimiter and cut can't say it as invalid delimiter...

it should work...

however try this...

cat test.log | paste - - | nawk 'BEGIN { FS="[/ ]" } { print $7,$8,$10 }'
  #5 (permalink)  
Old 01-24-2006
getdpg getdpg is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 72
cat test.log |paste - - | tr "/""" | cut -d"" -f7,8,10 >newtest


i tried to only replace / with spaces that is also not working
  #6 (permalink)  
Old 01-24-2006
mahendramahendr mahendramahendr is offline Forum Advisor  
Registered User
  
 

Join Date: Dec 2005
Location: London
Posts: 222
can you please compare the statement what i have posted and what you have typed...

copy both the lines in notepad and compare character by character..
you will know what mistake you have done...
  #7 (permalink)  
Old 01-24-2006
getdpg getdpg is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 72
sorry i didnt put space that's why it was giving me error
the first command is working..


but i am not getting number of failes .. because it is in second line ..
i am getting colunm 7 and 8 ..

can you tell me how to join the 2 lines..

i think i have to join first lines and then cut the data from file ..

pls write back
and thanks for helping me
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 09:31 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