Posts

Showing posts from September 14, 2018

Extract a number in a txt file by using regular expressions

Image
Clash Royale CLAN TAG #URR8PPP up vote 5 down vote favorite I am saving the output of terminal by 2>&1 | tee ./ results.txt in a .txt file which has the following text: executing: ./home/images/image-001-041.png 0,33, /results/image-001-041.png 1.7828,32, /results/image-001-040.png 1.86051,34, /results/image-001-042.png 1.90462,31, /results/image-001-039.png 1.90954,30, /results/image-001-038.png 1.91953,35, /results/image-001-043.png 1.92677,28, /results/image-001-036.png 1.92723,3160, /results/image-037-035.png 1.93353,7450, /results/image-086-035.png 1.93375,1600, /results/image-019-044.png I need to take the second numbers (after first comma sign, i.e. 33,32,34,...) and save it in a list in Python . What is the bash command, or the regular expression command in python? Thanks command-line bash python text-processing share | improve this question asked Apr 8 at 7:37 sc241 50 6 awk -F ',' 'print $2' results.t...