regex - Using grep, how can I extract every number from a blob of text? -


unlike previous question, want on commandline (just grep).

how can grep every number text file , display results?

sample text:

this sentence 1 number, while number 2 appears here, too. 

i expect able extract "1" , "2" text (my actual text substantially longer, of course).

i think want this,

$ echo 'this sentence 1 number, while number 2 appears here, too.' | grep -o '[0-9]\+' 1 2 

since basic sed uses bre (basic regular expression), need escape + symbol repeat previous character 1 or more times.


Comments

Popular posts from this blog

python - Specify path of savefig with pylab or matplotlib -

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -