I'm using unix to read through an excel file, sort by one column, and then I want a percentage (lets say the top 10%) of the sorted lines exported to a new .xls file. I have the code below which works fine but I need to do a wc -l
prior to this line to get the "126", and then have to type it in (which is a hassle since I want to do successive filtering).
cat /Desktop/Results.xls | sort -n -k 3 | awk -F "[\t]" '{printf "%s\n",$0}' | head -$((126*1/10)) >./Results_0167_1.xls