#!/bin/bash run (){ for((i=1; i<=1000; i++)) do ./tool -r $RANDOM | gawk 'BEGIN{FS=",";OFS=",";} NR>1 {print $(NF-1),$NF;}'; done } run > output.csv;