Thank you. I was thinking if I can have more dynamic values.
Hello Nina2910,
Let's say I have edited your Input_file as follows.
Code:
cat Input_file
COLUMN1 COLUMN2 COLUMN3 COLUMN4 COLUMN5 COLUMN6 SMS Email AO Mail Post N Cell
VEGE Potato E W 396 12 0 384 0 0 0 0 0
VEGE Onion S W 17 0 17 0 0 0 0 0 0
FRUIT APPLE N W 549 61 0 0 0 0 0 488 0
FRUIT APPLE SE W 291 14 239 38 0 10 0 0 10
FRUIT APPLE EA W 397 32 309 56 309 309 0 0 0
FRUIT APPLE MS W 397 32 309 56 309 309 0 0 10
FRUIT APPLE SEA W 808 58 663 87 488 20 0 0 0
FRUIT APPLE EAMS W 397 32 309 56 309 309 0 0 0
FRUIT APPLE EAS W 397 32 309 56 309 309 0 0 0
FRUIT APPLE EAM W 397 32 309 56 309 309 0 0 0
FRUIT APPLE SMEAC W 808 58 663 87 488 20 0 10 0
FRUIT APPLE CSEAN W 808 58 663 87 488 20 0 10 0
FRUIT APPLE MCSEA W 808 58 663 87 488 20 0 01 0
Then when I run my code posted in POST#3 as follows is the result.
Code:
COLUMN1 COLUMN2 COLUMN3 COLUMN4 COLUMN5 COLUMN6 SMS Email AO Mail Post N Cell
VEGE Potato E W 396 12 0 384 0 0 0 0 0 Good
VEGE Onion S W 17 0 17 0 0 0 0 0 0 Good
FRUIT APPLE N W 549 61 0 0 0 0 0 488 0 warning
FRUIT APPLE SE W 291 14 239 38 0 10 0 0 10 warning
FRUIT APPLE EA W 397 32 309 56 309 309 0 0 0 Good
FRUIT APPLE MS W 397 32 309 56 309 309 0 0 10 warning
FRUIT APPLE SEA W 808 58 663 87 488 20 0 0 0 Good
FRUIT APPLE EAMS W 397 32 309 56 309 309 0 0 0 Good
FRUIT APPLE EAS W 397 32 309 56 309 309 0 0 0 Good
FRUIT APPLE EAM W 397 32 309 56 309 309 0 0 0 Good
FRUIT APPLE SMEAC W 808 58 663 87 488 20 0 10 0 warning
FRUIT APPLE CSEAN W 808 58 663 87 488 20 0 10 0 warning
FRUIT APPLE MCSEA W 808 58 663 87 488 20 0 01 0 warning
So could you please let me know about following question's answers here.
i- Is above code working as per your expectations or not?
ii- So as per your requirements only strings AEMCSN or specific strings mentioned by you could be in $3, if this is true then in code for single character conditions are there(for different single character different fields we need to add and compare so they are different in conditions there), you have mentioned it needs to be more dynamic, could you please elaborate it more.
Please try to rephrase your requirements in a single post with code tags please, with sample Input_file and expected output sample too.
EDIT: BY seeing your try to edit my code got a little pulse of your objective here(may be), so could you try follwing and let us know if this helps you.
Hi,
I am new to unix and I need help in solving below mentioned issue, really appreciate ur help.
I have a file
sam, john, 2324, 07142007
tom, thomson, 2343, 07142007
john, scott, 2478, 07142007
its a comma delimited file, I need to extract the last column from each line and this... (4 Replies)
Hi All,
I have two files
file1:
abc,def,ghi,5,jkl,mno
pqr,stu,ghi,10,vwx,xyz
cba,ust,ihg,4,cdu,oqw
file2:
ravi,def,kishore
ramu,ust,krishna
joseph,stu,mike
I need two output files as follows
In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Hi All,
I have two files
file1:
abc,def,ghi,5,jkl,mno
pqr,stu,ghi,10,vwx,xyz
cba,ust,ihg,4,cdu,oqw
file2:
ravi,def,kishore
ramu,ust,krishna
joseph,stu,mike
I need two output files as follows
In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
I would like to compare the values of 2nd column of consecutive lines of same file in such a way so that if the difference between first value and second value is more than 100 it should print complete line else ignore line.
Input File
==========
PDB 2500
RTDB 123
RTDB-EAGLE 122
VSCCP 2565... (4 Replies)
Hi,
I have a table in unix from which i want to read the contents line by line, then filter out the values from 6th column one by one and compare it a fixed value.
How to do this? (7 Replies)
- I have two files (File 1 and File 2) and the contents of the files are mentioned below.
- I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2.
- I tried to modify and use... (10 Replies)
Hi all !
If there is only one single value in a column (e.g. column 1 below), then return this value in the same output column.
If there are several values in the same column (e.g. column 2 below), then return the different values separated by "," in the output.
pipe-separated input:
... (11 Replies)
Dear Unix experts,
I have got a file where I would like to compare the values of second column if first column is same in such a way that the difference between the values is >50. If not, I would like to discard both values.
For example, my input file looks like -
comp275_c0_seq2 73... (7 Replies)
I would like to compare values in column 8, and grep the ones where the different is > 1, columns 1 and 2 are the key for array.
Every 4 rows the records values in columns 1 and 2 changed. Then, the comparison in the column 8 need to be done for the 4 rows everytime columns 1 and 2 changed
... (4 Replies)