how can i output the number 2641569270623 from a text file called checkpoint.txt that is a one line file (generated by a maths sieving program) that looks like:
pmin=2641569270623,factor_count=8,cpu_secs=1705.793,frac_done=0.002592,elapsed_secs=1710.844
i tried sed -n "/pmin=/,/,factor/ p" checkpoint.txt | sed "$ d" which ouputs nothing and sed -n "/pmin=/,/,factor/ p" checkpoint.txt which output the whole line
Ranges in sed are ranges of entire lines -- /pmin=/,/,factor/ means print each line starting with a line containing "pmin=" through a different line containing ",factor" (and starting over again if a subsequent line matches "pmin=" again).
You could do
sed -e 's/.*pmin=//;s/,factor.*//' checkpoint.txt
which will replace from start of line through "pmin=" with empty line, and ditto from ",factor" through to end of line. The result is still printed regardless of whether the resulting line is empty or not.