linux - Compare fraction values present in a text file and outputting it based on a criteria -
i have temp.txt file having contents shown when cat temp.txt
used
0.3
1.3
5.3
7.3
they in string format need compare using arithmetic operators
is possible read every line txt file , compare fixed number (lets 5.7). if criteria met need echo out terminal saying "well number bigger thresold " , output txt file.
edit: hope clarifies
awk '{ if ($1 > 5.7) print "number " $1 " larger 5.7" }' temp.txt | tee output_file.txt
if need threshold determined dynamically can pass argument awk (google how this).
edit: new format specified op
sed 's/.*>\(.*\)<.*/\1/' temp.txt | sed '/^<[^>]*>/d' $awk '{ if ($1 > 5.7) print "number " $1 " larger 5.7" }' | tee output_file.txt
Comments
Post a Comment