Awk+colpos+negative if for 20 values


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Awk+colpos+negative if for 20 values
# 8  
Old 07-21-2014
We have given you several suggestions.

We have asked you to show us the contents of the files your script is using (and you may have hidden some of those file under the heading "please find control files data"), but I don't want to try to guess at what parts of what you have shown us correspond to the file $config_file_path/crt_extracts_branch_gswid_cntl what parts of what you have shown us correspond to $SOURCE_DIR/${FILENAME[$x]}, what parts of what you have shown us correspond to the other files used by your script.

If you don't want to make use of those suggestions and just want us to rewrite your script for you, you have come to the wrong place.

If you want to learn how to write better code, clearly show us that you have tried to use our suggestions, show us clearly the data you're trying to process, and show us what isn't working.
# 9  
Old 07-21-2014
I learned something today.

Quote:
ob·li·gor
äbliˈgôr
noun Law
noun: obligor; plural noun: obligors
  1. a person who is bound to another by contract or other legal procedure.
Are you saying all 20 must be on the line or only one of the 20?

If it is one of 20, something like this should work:
Code:
grep -f obligors.txt myfile

obligors.txt
Code:
Obligor1
Obligor2
Obligor3

Mike
# 10  
Old 07-22-2014
Hi Don,

i have given control files data not the actual files data as it is huge in size.
here i am attaching one sample for your reference.
i have modified file extension *.txt as was unable to upload control files
# 11  
Old 07-22-2014
before script run file data
Code:
cat Crs_Assessment_Extract.txt
NA|ASSESSMENT|567890|234|6789-12-45 78:01:34|678901|ASSESSMENT|OPRTNL|PENDING|9012-45-78|fake|name|wzsf0d||45||8.01234567890123456||RTNG_DLR||901234
NA|ASSESSMENT|012345|789|1234-67-90 23:56:89|123456|ASSESSMENT|OPRTNL|PENDING|4567-90-23|who|knows|xzhqmv|CARRS rating of the 78/0123 operating report which are the financials of the merged companies and the RE purchase |23||6.89012345678901234||RTNG_DLR|678|012345
NA|ASSESSMENT|123456|890|2345-78-01 34:67:90|234567|ASSESSMENT|OPRTNL|PENDING|5678-01-34|some|one|xzhqmv|CARRS rating of the 89/1234 operating report which are the financials of the merged companies and the RE purchase |34||7.90123456789012345||RTNG_DLR|789|123456

after script run my output should be as below on every line i have to check 20 values on each line, none of the value not found in
Code:
GERMANY_Obligor_filter_ctl.txt

row/line i am writing to output

Code:
cat Crs_Assessment_Extract.txt
NA|ASSESSMENT|567890|234|6789-12-45 78:01:34|678901|ASSESSMENT|OPRTNL|PENDING|9012-45-78|fake|name|wzsf0d||45||8.01234567890123456||RTNG_DLR||901234

Code:
cat GERMANY_Obligor_filter_ctl
##Obligor information file
##For new obligor for search contion add "&& $colpos !=xxxxxx" in format
##make sure all condition values in single line
$colpos != 228070 && $colpos != 228071 && $colpos != 228072 && $colpos != 228073 && $colpos != 228074 && $colpos != 228075 && $colpos != 228076 && $colpos != 228077 && $colpos != 228078 && $colpos != 228079 && $colpos != 228080 && $colpos != 228081 && $colpos != 228082 && $colpos != 228083 && $colpos != 228084 && $colpos != 228085 && $colpos != 228086 && $colpos != 228196 && $colpos != 228299


Last edited by Corona688; 09-08-2016 at 12:27 PM.. Reason: Replaced private data with gibberish
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to sum the value with negative values?

Hi Gurus, I have requirement need to sum the value, the logic is if the value is negative then time -1, I tried below two ways. one is failed, another one doesn't work. awk -F"," '{if($8< 0 $8*-1 else $8) sum+=$8}{print sum, $8} END{printf("%.2f\n",sum)}' awk -F","... (4 Replies)
Discussion started by: ken6503
4 Replies

2. Shell Programming and Scripting

Conavert negative values to Zeros

Can anyone please assist me? Please find the attached input and output file for ur reference. a)Incase if i get negative value (ex:-000100) in the 11th column then i have to convert the value to 0000000(7 zeros-length is 7) and then print the entire record. b)Incase if there is no... (2 Replies)
Discussion started by: vinus
2 Replies

3. Shell Programming and Scripting

replacing negative values in a column with zero

Hi, i need help on replacing negative values in a column with 0. any quick fix on this? thanks much. for instance, input: 1 2.3 -0.4 -25 12 13 45 -12 desired output 1 2.3 0 0 12 13 45 (4 Replies)
Discussion started by: ida1215
4 Replies

4. Shell Programming and Scripting

error- multiplying negative decimal values

a=10.02 pattern=-11.01 b=$(echo | awk '{ print $a*$pattern}') echo $b its not working even ALso tried `expr $a \* $pattern` No LUCK (3 Replies)
Discussion started by: saluja.deepak
3 Replies

5. UNIX for Dummies Questions & Answers

Snmp Disk Problem = Negative Values

Ok, so i monitor disk space on remote machines using snmp. Works great for me. But whenever a particular partition happens to have Terabytes of data, snmp starts reporting negative values. Can someone please tell me how to get around this problem? The AllocationUnit is 512 bytes. Weird... (0 Replies)
Discussion started by: SkySmart
0 Replies

6. Shell Programming and Scripting

Find Where Values Change From Positive To Negative and viceversa

Hi all, I have a file that looks like shown below. I want to find places where the value in column 2 change from negative to positive and vice versa and return the value on column 1 at that point. I wonder if this is possible in shell script or awk .. please help! Here is the original data ... (6 Replies)
Discussion started by: malandisa
6 Replies

7. Shell Programming and Scripting

Sorting positive and negative values

Hello, I have a list like this : 1 2 -4 0 -3 -7 5 6 etc. Is there a way to remove all the positive values and print only the negative values, without using grep, sed or awk? Thanks, Prasanna (4 Replies)
Discussion started by: prasanna1157
4 Replies

8. Shell Programming and Scripting

printf in bash shell not printing negative values

hi i am using printf in a script and it is not printing negative values..i have to use printf to get rid of the newline..here is my code: fin=`echo $a - $b | bc` printf "${fin}," >> test these statements are in a loop. here is what i get when i try to subtract 4 from 8: ./scr1: line... (2 Replies)
Discussion started by: npatwardhan
2 Replies

9. Shell Programming and Scripting

Help in adding positive & negative values in a column

Hi Gurus, In my file I have an amount field from position 74 to 87, which contains values starting with '+' as well as '-'. I want to add all positive values in a varible called "CREDIT" and all negative values in a variable "DEBIT". I know, we can use grep to identify values with positive and... (4 Replies)
Discussion started by: berlin_germany
4 Replies
Login or Register to Ask a Question