Skip to content

Commit 4a9a640

Browse files
committed
trx example
1 parent 8691e87 commit 4a9a640

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

files/trx.dat

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REF623=1780086676
2+
REF123=2780086676
3+
REF423=3780086676
4+
PLU123,2=71004269
5+
REF523=4780086676

trx.awk

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# trx
2+
# Example: awk -v bomb=71004269 -f trx.awk files/trx.dat
3+
4+
BEGIN{FS="="}
5+
$2==bomb && gsub(/^PLU|,.*/,"",$1){b[$1]}
6+
$1 ~ /^REF/ {r[$1]=$2}
7+
END{
8+
for (i in b){
9+
for (j in r){
10+
if (j ~ i){
11+
print r[j]
12+
}
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)