pqwoerituytrueiwoq
August 28th, 2013, 05:03 PM
In Javascript i would do it like this
'model name : AMD Phenom(tm) II X4 965 Processor'.replace(/(^.*: | [Pp]rocessor|\([Tt][Mm]\))/g,'')
but sed's RegEx does not work the same, so i have been doing it with separate RegEx like this
cat /proc/cpuinfo |grep 'model name'|head -1|sed 's/^.*: //g;s/ [Pp]rocessor//;s/(\([Tt][Mm]\))//'
is there a more efficient way to write the sed part like i did in Javascript?
'model name : AMD Phenom(tm) II X4 965 Processor'.replace(/(^.*: | [Pp]rocessor|\([Tt][Mm]\))/g,'')
but sed's RegEx does not work the same, so i have been doing it with separate RegEx like this
cat /proc/cpuinfo |grep 'model name'|head -1|sed 's/^.*: //g;s/ [Pp]rocessor//;s/(\([Tt][Mm]\))//'
is there a more efficient way to write the sed part like i did in Javascript?