summaryrefslogtreecommitdiff
path: root/.power_unique.sh
blob: 25fb530f546c0fba9698d4a2aa3ade6df7a0903a (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env bash

tmp=$(mktemp)
while IFS= read -r line; do
    echo $line >> $tmp
done

last_line=$(cat $tmp | tail -n1)
cat $tmp | awk -F"," 'BEGIN{LAST=-1;skipped=0} {if(LAST!=$3){print $1","$2","$3;skipped=0}else{skipped=1} LAST=$3} END{if(skipped){print "'$last_line'"}}'
rm $tmp