Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-30-2008
Registered User
 

Join Date: Jul 2008
Posts: 44
Detemine if SED is successful

Is there a way of finding out if an issued sed command is successful?

Basically, in my script I have a command where mydata=$(cat record | sed '...command here...'). When the sed command finds the data that I am after it is assigned to mydata. When the sed command does not find the data I am after, xxxx is assigned the whole contents of the file, which is expected. I am processing a file using a while loop. I was wondering if an indicator is set to indication success or failure.
Sponsored Links
  #2 (permalink)  
Old 07-30-2008
fpmurphy's Avatar
Moderator
 

Join Date: Dec 2003
Location: Florida
Posts: 2,101
Unless an actual error occurs sed returns an exit value of 0, so testing the exit value is not an option.
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 Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Successful languages - show me the code please Linux Bot Complex Event Processing RSS News 0 06-14-2008 11:30 PM
Log successful unix conditionals kadi Shell Programming and Scripting 4 12-17-2007 03:21 PM
TCP\IP startup was not entirely successful (Unixware 7.1.1) renjithcb UNIX for Dummies Questions & Answers 0 03-20-2007 03:04 AM
Successful Installion of Apache cstovall UNIX for Dummies Questions & Answers 0 11-26-2002 11:16 AM



All times are GMT -4. The time now is 10:09 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-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0