Hello Guys,
I'm looking for a little assistance with a grep script for grabbing information from a command output and then comparing it to a text file.
Basicly i have an output from a command i've run that looks similar to the one below, and i'm looking to use grep and cut to remove all instances of the sections highlighted in red, then compare it to the list from a text file.
I then want to select the first instance that does NOT appear in the text file and then use that as a variable.
THE OUTPUT FROM MY COMMAND
MY TEXT FILE
So for instants with the example above, i would like the code to return 00:09:2D:31:69:4C as it is not present in the text file.
I know its a little complicated and i've probably not explained myself particularly well, but i'm new to Linux so you'll have to excuse my niavity.
Please let me know if there is any extra information i can pass your way to help with this.
I've tried using GREP as i know it and can only get it to return me the first instance of the search criteria when i really need a list of all instances within my command output.
Thanks for any help you can give me.
Rob
I'm looking for a little assistance with a grep script for grabbing information from a command output and then comparing it to a text file.
Basicly i have an output from a command i've run that looks similar to the one below, and i'm looking to use grep and cut to remove all instances of the sections highlighted in red, then compare it to the list from a text file.
I then want to select the first instance that does NOT appear in the text file and then use that as a variable.
THE OUTPUT FROM MY COMMAND
Code:
Searching for opush on [COLOR=red]00:09:2D:31:69:4C[/color] ...
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 [COLOR=red]00:0E:6D:04:6D:06[/color] ...
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
MY TEXT FILE
Code:
00:0E:6D:04:6D:06
00:0E:6D:04:6D:07
00:0E:6D:04:6D:08
00:0E:6D:04:6D:09
So for instants with the example above, i would like the code to return 00:09:2D:31:69:4C as it is not present in the text file.
I know its a little complicated and i've probably not explained myself particularly well, but i'm new to Linux so you'll have to excuse my niavity.
Please let me know if there is any extra information i can pass your way to help with this.
I've tried using GREP as i know it and can only get it to return me the first instance of the search criteria when i really need a list of all instances within my command output.
Thanks for any help you can give me.
Rob