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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
tar exclude list Tirmazi SUN Solaris 2 09-20-2008 08:53 AM
Exclude & Zip dreams5617 Shell Programming and Scripting 1 02-11-2007 05:01 PM
Tar directory but exclude other leemjesse UNIX for Dummies Questions & Answers 1 05-09-2006 06:33 AM
Getting 'tar' to exclude kuultak UNIX for Dummies Questions & Answers 6 02-07-2005 04:31 PM
tar: how to exclude subdirectories? kymberm Filesystems, Disks and Memory 7 10-15-2002 12:53 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-24-2008
Registered User
 

Join Date: May 2005
Posts: 190
exclude a line

Hi,
thanks for your help. I wrote this script :
Code:
# ! /bin/sh
file=snapshot.txt
cat $file | while read line ;
do
{
myvariable=`grep "Nombre de ROLLBACK internes" |sed 's/.*.=//'`
echo $myvariable
}
done
It looks in a file "snapshot.txt" for the lines containing "Nombre de ROLLBACK internes". But there are two lines containing this :
Nombre de ROLLBACK internes = 0
Nombre de ROLLBACK internes dus à interblocages = 7

How can I exclude the following line :
Nombre de ROLLBACK internes dus à interblocages = 7


This my snapshot.txt file :
Code:
Num. de partition de base de données du catalogue       = 0
Nom du catalogue du noeud réseau                        =
Syst. d'exploitation serveur de base de données         = NT
Nombre de ROLLBACK internes = 0
Nombre de ROLLBACK internes dus à interblocages = 7
Emplacement de la base de données                       = Local
Horodatage de la première connexion à la base     = 18.04.2008 05:31:56.832765
Regards.
Reply With Quote
Forum Sponsor
  #2  
Old 04-24-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,275
one way
Code:
myvariable=`grep "Nombre de ROLLBACK internes" | grep -v "dus à interblocages" | sed 's/.*.=//'`
Reply With Quote
  #3  
Old 04-24-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,202
Some possibilties:

Code:
grep 'Nombre de ROLLBACK internes =' snapshot.txt |cut -d" " -f6

awk '/^Nombre de ROLLBACK internes =/{print $6}' snapshot.txt

sed '/^Nombre de ROLLBACK internes = /s/.*= //' snapshot.txt
Regards
Reply With Quote
  #4  
Old 04-24-2008
Registered User
 

Join Date: May 2005
Posts: 190
thank you.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0