I want to extract the text "Windows 2008" sandwiched between [VM STORE] and "/Windows 2008.vmx"
So I need two field separators ] for the left and / for the right.
So for awk I use "[]/]" as the argument to -F.
Then I need to trim the spaces using sed.
echo "32 EDI Windows 2008 [VM STORE] Windows 2008/Windows 2008.vmx winLonghornGuest vmx-07 EDI Data Integrator OS" | awk -F"[]/]" '{ print $2 }' | sed 's/^[[:space:]]*\(.*\)[[:space:]]*$/\1/'
Reference[1]: http://kirk.webfinish.com/2009/02/sed-script-to-trim-leading-and-trailing-spaces/
0 Comments