![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|