My input files are a single column with variable length of rows. My code is supposed to count those rows, and print a specified number. The problem I'm having, is if the number of rows captured in the variable A is less than 1, I want it to print at least 1 row so the output file isn't empty. If A (1% of the total number of rows) is greater than 1, I want to print that number of rows. My hybrid awk-bash code looks like this:#!/bin/shfor i in {1..2}doinput=../ExpressionSet_$i_chunk.txt    for j in {1..2}doA=$(awk 'END{print NR*0.01}' $input)Y=1X=0if (( $A -lt $Y)); thenX=$A+1elseX=$Afiawk 'NR<='$X' {print $0}' $input > $i_top1pc.txtB=$(awk 'END{print NR*0.05}' $input) awk 'NR<='$B' {print $0}' $input > $i_top5pc.txtConfusingly, I keep getting error messages like thresholdSelector_pc.sh: line 20: ((: 0.24 -lt 1: syntax error: invalid arithmetic operator (error token is .24 -lt 1)thresholdSelector_pc.sh: line 20: ((: 47.24 -lt 1: syntax error: invalid arithmetic operator (error token is .24 -lt 1)By the way, inputFile1 has 24 lines and inputFile2 has 4724 lines. Thanks for the help!
Variable Capture and For-Loop Arithmetic
bash;awk