How do I perform a regex match on a file and output the result.
For example, find version="X.Y.Z" and store in a variable the matched result of X.Y.Z so as to be later able to echo the match.
The is as far as I've gotten on my own: sed -n -e 's/version\=\".*\"' $PATH"version.js"
My file contents are:
var config;
function check() {
if (window.environment && window.revision) {
config.version = "0.0.1";
config.isApp = true;
}
else {
setTimeout(check);
}
}
check();
and I wish to store 0.0.1 in a variable as I wish to insert this value into another file.



cat version.js | grep ...not do the trick in this case ?