test.txt file:
Ext Temperatur: 210.0°
Avg.Speed(All): 62.89mm/s
Avg.Speed(Print): 49.99mm/s
Avg.Speed(Travel): 199.84mm/s
Overall Time (w/o Acceleration): 11:00:41 (39640.65sec)
How can I grab 62.89mm/s and 62.89 as outputs using grep and print with php code?
I am using this code but it prints the whole line e.g.: Avg.Speed(All): 62.89mm/s
<?php
$gcode_new = "grep -P 'Avg.Speed(All):' test.txt";
include('Net/SSH2.php');
$ssh = new Net_SSH2('XXX.61.XXX.227');
if (!$ssh->login('root', 'PASS')) {
exit('Login Failed');
}
$target = $ssh->exec($gcode_new);
echo $target ;
?>
Question Update: How can i copy 11:00:41 from above data which is associated with "Overall Time (w/o Acceleration):" Tried to use the command which is suggested from answer, but receiving 11:00:41 (39640.65sec) here how can i avoid (39640.65sec).
$ grep -Po '(?<=Overall Time \(w/o Acceleration\): ).*' testjar.txt