Detemine if SED is successful


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Detemine if SED is successful
# 1  
Old 07-30-2008
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.
# 2  
Old 07-30-2008
Unless an actual error occurs sed returns an exit value of 0, so testing the exit value is not an option.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Can't boot FreeBSD after successful installation.

This is a cross post as I haven't got any solution and I'm badly in need of one. I've installed Slackware 14.2 in /dev/sda1 and x86Solaris 10 U6 in /dev/sda3 (sda2 is Linux swap)and boot menu was Solaris grub but, later deleted Solaris partition and installed FreeBSD12 (for i386) on the same... (3 Replies)
Discussion started by: vectrum
3 Replies

2. Shell Programming and Scripting

How to check whether the sftp script is successful??

hi, how can i check whether the sftp connectivity is successful or not?? i am using expect script to connect to sftp.. sftp_script spawn /usr/bin/sftp abc@ftp.xyz.com expect "abc@ftp.xyz.com's password:" send "password\r" expect "sftp>" send "mput *.txt\r" expect "sftp>" send "bye\r"... (8 Replies)
Discussion started by: Little
8 Replies

3. Shell Programming and Scripting

FTP Status check(whether it is successful or not)

Hi Friends I need to check the status of FTP connection i.e. Whether it is successful or not I have tried this by assigning the FTP connection script to a variable and after that using this variable I tried to check the status. In the below code snippet I am trying to assign the FTP... (1 Reply)
Discussion started by: Kannannair
1 Replies

4. UNIX for Advanced & Expert Users

Wether does it successful or unreachable?

Hi, all: How can I check what happen with my own NIC driver which response "successful" when local PC "ping" a remote linux PC but "unreachable" when it "ping" a remote windows XP PC? My writed driver runs in linux 3.0.4 kernel. thanks! li, kunlun (1 Reply)
Discussion started by: liklstar
1 Replies

5. Solaris

How to view only successful login?

Hi all, I have to view only success full login attempts . View who are all logged in correctly , and where it can be stored? Thanks in advance Gnanavel (3 Replies)
Discussion started by: Gnanavel
3 Replies

6. Shell Programming and Scripting

How to determine whether the FTP was successful or not

Hi, In a shell script we issue a ftp command to transfer some files, so the shell script process invokes another FTP Process. The ftp session has started but due to some reason the ftp is broken, then how to determine in the script that the file transfer was not successful. We can make a check... (5 Replies)
Discussion started by: julie_s
5 Replies

7. UNIX for Dummies Questions & Answers

Test if execution was successful

Hi How can I test inside a shel script whether the last action was successful or not. I have the following line which is executing inside a script . ./runProcess.sh $i $var_num>> error.txt 2>&1 This is occuring in a loop. How can i test whether it was succes for last var_num or not. How... (2 Replies)
Discussion started by: Prashantckc
2 Replies

8. UNIX for Dummies Questions & Answers

TCP\IP startup was not entirely successful (Unixware 7.1.1)

Hi guys ... I'm a noob to UNIX & Im stuck with this error "TCP/IP startup was not entirely successful" during startup of the box after "initialize -U " is run by the system. If i open netcfg, i cant see TCP/IP protocol anywhere only IPSX is visible. This machine was running on another network... (0 Replies)
Discussion started by: renjithcb
0 Replies

9. UNIX for Dummies Questions & Answers

Successful Installion of Apache

I finally finished installing Apache on my companies SCO server. The problem was with the way I uncompressed the Apache .tar.z file. I downloaded Apache onto a windows computer on our network. Then I used winzip to uncompress the files. After un- compressing the files, I transferred them to the... (0 Replies)
Discussion started by: cstovall
0 Replies
Login or Register to Ask a Question