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
Grep Three Words murbina UNIX for Dummies Questions & Answers 12 08-14-2008 03:38 AM
Match words moutaz1983 Shell Programming and Scripting 8 01-07-2008 06:26 AM
dictionary words in vim lakshmananindia UNIX for Advanced & Expert Users 1 09-06-2007 06:28 AM
Looking for Words File OC Del Guy UNIX for Dummies Questions & Answers 9 04-12-2006 07:27 AM
extracting some words mark_nsx Shell Programming and Scripting 2 10-09-2005 11:48 PM

Closed Thread
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
  #1 (permalink)  
Old 07-30-2006
kakashi_jet kakashi_jet is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 12
Get the words..

Hi All,

I'm a newbie with scripting.
Can you help me on how to get the 'zekmsam221_0730.log' string from this string?

zekmsam221_0730.log:ORA-00942: table or view does not exist

Thanks,
Jet
  #2 (permalink)  
Old 07-30-2006
tayyabq8's Avatar
tayyabq8 tayyabq8 is online now Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 578
Try:
Code:
echo "zekmsam221_0730.log:ORA-00942:" | cut -d: -f1
  #3 (permalink)  
Old 07-30-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,209
Code:
line="zekmsam221_0730.log:ORA-00942:"
file=${file%%:*}
echo file

Last edited by reborg; 07-31-2006 at 08:32 AM..
  #4 (permalink)  
Old 07-31-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
Code:
$ echo "zekmsam221_0730.log:ORA-00942:" | sed 's/^\([^:]*\):.*$/\1/'
zekmsam221_0730.log
  #5 (permalink)  
Old 07-31-2006
kakashi_jet kakashi_jet is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 12
Thanks for the reply.
Can we make it more flexible? Let say we don't know the 'zekmsam221_0730.log' string but we know that there is always an 'ORA-' after 'zekmsam221_0730.log' string.
Is it still possible to get the string before the ':ORA-...'?
  #6 (permalink)  
Old 07-31-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by kakashi_jet
Thanks for the reply.
Can we make it more flexible? Let say we don't know the 'zekmsam221_0730.log' string but we know that there is always an 'ORA-' after 'zekmsam221_0730.log' string.
Is it still possible to get the string before the ':ORA-...'?
Code:
string=zekmsam221_0730.log:ORA-00942:
echo ${string%%:ORA*}
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:25 AM.


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