Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
I've just started to work with shell scripting and sed today. I'm trying to figure out how I can extract data from a file. Basically the file I want to extract data is a streaminfo file from my satellite receiver box (dreambox) and the file structure looks like this:
[html tags]
[html tags]VPID:[html tags]123h[html tags]APID[html tags]:[html tags]678b
[html tags]That's the gist of it. I've found out how to strip the html tags from the file using sed but actually I don't really even need to do that.
What I want to do is for instance search for the string "VPID" in the file above and then extract the sequence of numbers/letters that follows that. I need to extract it in the form of a variable as I'm running this from a shell script and I want to use that extracted data later on in the shell script.
If I strip the html tags then the file looks like:
VPID: 123h APID: 678b
I've not quite got the hand of regex yet and I was wondering if there's a simple way to go about getting this data out of the file.
Any help would be greatly appreciated.
Thanks in advance,
The Wolverine :D

![]() |
whats wrong in this
|
Find a string; print next...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |