I am trying to find the best way how to parse specific output from jsch when connecting and executing commands on a c7000 HP enclosure.
What I have done so far is written a program that connects to a hp enclosure, executes a command, retrieves the output of the command and converts it from a stream to a String.
I end up with this String
Server Blade #1 Information:
Type: Server Blade
Manufacturer: HP
Product Name: ProLiant BL280c G6
Part Number: 507865-B21
System Board Spare Part Number: 531337-001
Serial Number: XZ73616G9Z
UUID: 38926035-5636-5D43-3330-359274423959
Server Name: SERVERONE
Asset Tag: [Unknown]
ROM Version: I25 02/01/2013
CPU 1: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz (4 cores)
CPU 2: Intel(R) Xeon(R) CPU E5520 @ 2.27GHz (4 cores)
Memory: 49152 MB
Now I need to extract some information from this string and put it in a variable/variables. I have tried with regex but don't seem to hack it. What I need is to end up with for example, product name "Proliant BL280c G6" in a string variable that I later can use, same goes with serial number or any other info in there. What I do not need is the preceding text as Type: or Part Number:. I only need to extract what comes after that.
I am pretty new with Java, learning lots every day, can anyone here point me in the right direction of the best way of solving this?
EDIT: Thank you very much all for quick responses. I got a few ideas now on how to solve the problem. The biggest help goes to showing me how to use regex expressions correctly. What i missed there was the possibility of excluding string pieces not needed ex. (?<=Product\sName:).