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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shcov - Shell script execution coverage testing 1 (Default branch) iBot Software Releases - RSS News 0 12-15-2008 07:00 AM
Testing a comand in the script Lutchumaya Shell Programming and Scripting 2 01-25-2007 02:37 AM
Testing telnet connections in a script dikiee Shell Programming and Scripting 0 01-12-2007 09:40 AM
Testing ssh connection from KSH script dmilks Shell Programming and Scripting 8 06-02-2005 04:34 AM
testing for file size in script Ivo UNIX for Dummies Questions & Answers 3 03-13-2002 02:59 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-30-2009
kretara kretara is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 15
Question Testing success of AWK code in KSH script

I need a bit of help here on something simple.

I have a KSH script (must be KSH) that needs to change 2 positional variables in a CSV script.

The CSV script looks like this:

00001,010109,01/01/2009 00:01:01
00008,090509,09/05/2009 13:47:26


My AWK script will change $2 and $3 based on the value of $1.
The values in $1 are distinct and must match to one of the values in the first column with every call to this script.


Code:
cat csv_file.csv | awk 'BEGIN {FS=","; OFS=FS}
  	{
  		if($1 == one) {
  			$2 = two
  			$3 = three
  		}
  	print 
  	}' one="${one}" two="${two}" three="${three}" > tmp_file.csv

So far it works fine.

What I'm wondering how to do is to test if the AWK code successfully completed.
If I call $? I always get a status of 0 (since the cat does work fine).

How do I verify that the AWK code did not error out?
 

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 08:15 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