MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
March
Sun Mon Tue Wed Thu Fri Sat
   
16
   
2016
Months
Mar


Wed, Mar 16, 2016 10:40 pm

Extracting numbers from a text string with grep

The grep command-line utility found on Unix, Linux, and OS X systems can be used to extract strings from files or other data input to the command. As an example of extracting digits from a string, suppose I have the following text that contains a version number between <string> and </string>:

<string>14.6.0</string>

I only want to see the 14.6.0, so I can use the grep command with the -o option to specify I ony want the text that matches a specified pattern displayed. The pattern I can use is '[0-9.]\+'.

[ More Info ]

[/os/os-x] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo