I'm just n00b when it comes to using sed and can't figure it out ...
I have the following data that is output using the command line tool:
ruby: interpreter: "ruby" version: "1.8.6" date: "2010-02-04" platform: "i386-mingw32" patchlevel: "398" full_version: "ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]" homes: gem: "" ruby: "C:\ruby\ruby-1.8.6-p398-i386-mingw32" binaries: ruby: "C:\ruby\ruby-1.8.6-p398-i386-mingw32\bin" irb: "C:\ruby\ruby-1.8.6-p398-i386-mingw32\bin\irb.bat" gem: "C:\ruby\ruby-1.8.6-p398-i386-mingw32\bin\gem.bat" rake: "" environment: GEM_HOME: "" HOME: "c:/Users/derick" IRBRC: "" RUBYOPT: "" file associations: .rb: .rbw:
I want to use sed to extract values ββonly from interpreter and version and return them as an "interpreter-version".
The best I could think of was to use grep to return the entire version string:
pik info | grep -e '^version:.*'
but this returns too much information from the version line and does not include the interpreter (obviously).
How can I use sed to extract only bits of information that I want to get the result of ruby-1.8.6 ?
... or grep, or awk, or any other command line tool to get the information I want ...
FWIW: I do not use RVM because it is a Windows machine using MinGW32 ... I use Pik, which is similar to RVM, but made for Windows.
source share