ina260-zmq-publisher/.power_unique.sh

12 lines
289 B
Bash
Raw Normal View History

2024-01-21 11:07:50 +01:00
#!/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