Sponsored Content
Full Discussion: Nawk if logic problem
Top Forums Shell Programming and Scripting Nawk if logic problem Post 302826341 by wawa on Wednesday 26th of June 2013 10:45:31 AM
Old 06-26-2013
Code:
nawk '{ fmt="%3s %22s %48s %35s %21s\n";
             if ($3==$6 && $1=="STOPLOSS") {
                 tpy="Successful Match";
                 jnme=$1;
                 sts="File will be loaded";
                 cntrl=$3;
                 audit=$6;
                 printf (fmt, tpy,jnme,sts,cntrl,audit) >> "'${AUDIT_DATA_FILE}/${AUDIT36}'"
              }
              else if ($3!=$6 && $1=="STOPLOSS") {
                      tpy="Mis-Match            ";
                      jnme=$1;
                      sts="File will NOT be loaded";
                      cntrl=$3;
                      audit=$6;
                      printf (fmt, tpy,jnme,sts,cntrl,audit) >> "'${AUDIT_DATA_FILE}/${AUDIT36}'"
                    }
                    else if ($1=="NO_FILE") {
                    jnme=$1;
                    sts=$2;
                    cntrl=$3;
                    printf (fmt, jnme,sts,cntrl) >> "'${AUDIT_DATA_FILE}/${AUDIT36}'" } }' ${AUDIT_DATA_FILE}/${AUDIT3c}

I hope this helps
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

nawk problem

How are ya, Heres the problem. I have a line of data that can either be in this format. "20" or "20kg" for the 20kg one i need to be able to read that their is kg on the end of this field and then ignore it and move on to the next line. Can anyone help. Cheers (3 Replies)
Discussion started by: ben_shark
3 Replies

2. Shell Programming and Scripting

Problem with if logic

Hi there, In my shell program I have two if statements the first one checks that the date in yyyymm format is equal to a date from the parameter file in yyyymm format, and that the file and sends an appropiate email The second one checks that the date in yyyymm format is equal to a... (1 Reply)
Discussion started by: rjsha1
1 Replies

3. Shell Programming and Scripting

Please help me to figure out the logic for this problem

Hello, i am on 2.6.13-1.1526_FC4smp i have directory named /home , and in there i have directory 2009_10_10 and two files : 2009_10_10.log and 2009_10_11.log How to write shell script which will delete only file/s that don't have his/their 'parent' directory, so in this case , only... (7 Replies)
Discussion started by: tonijel
7 Replies

4. Shell Programming and Scripting

Multiple array problem in NAWK

I HAD these 2 files: file1 pictures.txt 5 ref2313 4 ref2345 3 ref5432 2 ref4244 1 dance.txt 6 ref2342 5 ref2352 4 ref0695 3 ref5738 2 ref4948 1 treehouse.txt 6 ref8573 5 ref3284 4 ref5838 3 ref4738 2 ref4573 1 file2 pictures.txt 1 3 dance.txt 2 4 treehouse.txt 3 5 what I... (1 Reply)
Discussion started by: linuxkid
1 Replies

5. UNIX for Dummies Questions & Answers

if then else logic with while loop problem

Hi Friends, I have to do write a shell file based on one flag.If that flag value is 'N' then process look in $DATA are and the normal process continue.If vaule is 'P' then it check for the files in different location $CONV and move those file in $DATA area and rest of the process... (2 Replies)
Discussion started by: Param0073
2 Replies

6. Shell Programming and Scripting

problem in redirecting records using nawk

I am trying to redirect record to two files using nawk if-else. #Identify good and bad records and redirect records using if-then-else nawk -F"|" '{if(NF!=14){printf("%s\n",$0) >> "$fn"_bad_data}else{printf("%s\n",$0) >> $fn}}' "$fn".orig "$fn".orig is the source file name bad... (7 Replies)
Discussion started by: siteregsam
7 Replies

7. Shell Programming and Scripting

Nawk Problem - nawk out of space in tostring on

Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)
Discussion started by: Abhiraj Singh
12 Replies
ISWCNTRL(3)						     Linux Programmer's Manual						       ISWCNTRL(3)

NAME
iswcntrl - test for control wide character SYNOPSIS
#include <wctype.h> int iswcntrl(wint_t wc); DESCRIPTION
The iswcntrl() function is the wide-character equivalent of the iscntrl(3) function. It tests whether wc is a wide character belonging to the wide-character class "cntrl". The wide-character class "cntrl" is disjoint from the wide-character class "print" and therefore also disjoint from its subclasses "graph", "alpha", "upper", "lower", "digit", "xdigit", "punct". For an unsigned char c, iscntrl(c) implies iswcntrl(btowc(c)), but not vice versa. RETURN VALUE
The iswcntrl() function returns nonzero if wc is a wide character belonging to the wide-character class "cntrl". Otherwise it returns zero. CONFORMING TO
C99. NOTES
The behavior of iswcntrl() depends on the LC_CTYPE category of the current locale. SEE ALSO
iscntrl(3), iswctype(3) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
1999-07-25 ISWCNTRL(3)
All times are GMT -4. The time now is 10:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy