Hello Guys,
I'm very new to the Linux OS so you'll have to excuse any niave comments i'll make, but i'm sure you'll make me feel welcome.
Basicly i have a command that is presenting me with a reasonable amount of output and i need to grab two parameters from that output and then organise it.
I've been playing around with the GREP, EGREP, TR and CUT commands all day and havn't managed to quite achieve what i'm looking for. Below you will see an example of the output that is generated by my command and below that a rough example of the way i want it to look once it's been trimmed and organised.
Code:
Searching for opush on 00:09:2D:31:69:4C ...
Service Name: OBEX Object Push
Service RecHandle: 0x10008
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x656e
encHoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100
Searching for opush on 00:0E:6D:04:6D:06 ...
Service Name: OBEX Object Push
Service RecHandle: 0x10004
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 9
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100
You can see in bold and red the content that i want to strip out from my output, i should probably say at this point that there is not always two devices listed there could be quite a few more.
I then want to display that content in a list and seperate the address and the channel using a '-' so it resembles somthing like this:
Code:
00:09:2D:31:69:4C-2
00:0E:6D:04:6D:06-9
For now we can just echo that output onto the screen but in future i will be outputing it into a txt file, but i've already got that element sorted.
I'd like to keep this all command line based using things like grep rather than relying on anything like Perl, just as i'm no good with perl and it will make like easier for maintanance.
I've got a whole host of other command line scripts that i will be using in conjunction so i'm reasonably experianced in the code, just this text manipulation has gotten me stumped.
Any advice you can offer would be greatly appreciated.
Thanks,
Rob