Search Results

Search: Posts Made By: aberg
2,820
Posted By jim mcnamara
This requires a lot of memory depending on what...
This requires a lot of memory depending on what you have in reference.txt
Simple awk which can be rewritten as something difficult to read for non-awkers.
We have posters who do that, which is okay...
3,061
Posted By RudiC
In fact, what I applied is your logic from...
In fact, what I applied is your logic from post#1, deploying the fact that the two expressions are mutually exclusive except for the $5 == $6 case. The result of a boolean expression is either 1...
3,061
Posted By RudiC
I'm not yet sure I entirely grasp it, but that...
I'm not yet sure I entirely grasp it, but that "grinding itself down to 0 lines" confirms my gut feeling about the processing. Unfortunately the few sample limes don't allow for a thorough testing....
3,061
Posted By vbe
e.g If $3 > $4, print $2 (ID2) >...
e.g

If $3 > $4, print $2 (ID2) > exclusionlist.txt # This one will create or if exist,overwrite
If $3 < $4, print $1 (ID1) >> exclusionlist.txt # Then here you append...
If $3==$4 && $5 <...
22,613
Posted By Yoda
Using awk:- awk 'NR==FNR{A[$1];next}$1 in A'...
Using awk:-
awk 'NR==FNR{A[$1];next}$1 in A' reference.txt data.txt
Using grep (no need to use cat):-
grep -f reference.txt data.txt
1,199
Posted By Aia
awk '{if(p[$2]<$3){p[$2]=$3;c[$2]=$1;}}END{for(i...
awk '{if(p[$2]<$3){p[$2]=$3;c[$2]=$1;}}END{for(i in c){print c[i]}}' example.data

Output:

113
112
118
115
1,199
Posted By rdrtx1
sort -n -k2 -k3 infile | awk '!a[$2]++ && l...
sort -n -k2 -k3 infile | awk '!a[$2]++ && l {print l} {l=$1}; END {print l}'
1,199
Posted By RavinderSingh13
Hello aberg, If you are not worried about...
Hello aberg,

If you are not worried about the order of the printing of 1st field then following may help you in same.
Please let me know how it goes then.

awk...
6,686
Posted By Scrutinizer
Can it be that your input files are in DOS format...
Can it be that your input files are in DOS format (contain carriage returns)?

Try:
tr -d '\r' file > file.new

first and on both files and try again...

---
Otherwise there may be excess...
6,686
Posted By Yoda
awk -F: 'NR==FNR{a[$1]=$2;next}$1 in...
awk -F: 'NR==FNR{a[$1]=$2;next}$1 in a{$1=a[$1]}1' ref_file file1
Showing results 1 to 10 of 10

 
All times are GMT -4. The time now is 06:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy