| Need to extract a string from unstructured file. First, I apologize if I've reached the wrong forum for this scripting related question but a forum search didn't find me any useful hits so I came here.
What I'm trying to accomplish is to be able to locate and extract a copy of a string from an unstructured text file. I can use various commands combined with a regexp to location virtually anything I want but it returns whole lines. The only tools I'm familiar with require columnized data with known delimiters so I'm stuck.
So for example:
# egrep '..:..:..:..:..:..' dmesg
e100: eth0: e100_probe: addr 0xc0110000, irq 20, MAC addr 00:0D:60:07:92:22
#
Now I need to grab only '00:0D:60:07:92:22' from the returned line of text without knowing the delimiter or position of what I'm looking for. If anybody knows a technique for doing this without having to loop through the data, it'd really be helpful.
Any ideas are welcome--thanks. |