What will be grep regex to extract version number like
Version: 3.1.5
* Version: 3.1.5
Will output 3.1.5
But It should not catch likes
MIME-Version: 1.0\n
Here is my grep command
grep -ri 'version\s*:\s*[0-9\.]\w*' /home/test/public_html/wp-content/plugins/plugin_name
not working
grep -Po "(^|\s)+(Version: )\K([0-9]|\.)*(?=\s|$)" /home/test/public_html/wp-content/plugins/woocommerce/
woocommerce is a folder. There is file woocommerce.php under this folder.
Content of woocommerce.php
* Plugin Name: WooCommerce
* Plugin URI: http://www.woothemes.com/woocommerce/
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
* Version: 2.3.8
* Author: WooThemes
* Author URI: http://woothemes.com
* Requires at least: 4.0
* Tested up to: 4.2
Working
grep -rPo "(^|\s|^\*)+(Version\s*:\s*)\K([0-9]|\.)*(?=\s|$)" /home/test/public_html/wp-content/plugins/attachments/
grep -rPo .... /directory