| Ed Morton 2005-11-23, 5:54 pm |
|
jonhardt@yahoo.com wrote:
> Here's kind of a goofy one...haven't figured out how (if) it is doable
> by sed/awk yet, so I thought I'd give the brain trust here a looksee
> and determine if there is a better way to handle this issue...
>
> I have several large txt files that I need to search for a particular
> string and assign the value on a subsequent line to a variable...so for
> instance using this snippet:
>
>
> ---=[ OS Version (Version.Release.Modification.Fix)
> ]=--------------------
> 5.3.0.0
>
>
> I want to be able to search the file for the string
> "Version.Release.Modification.Fix"
>
> and assign the variable OS_VER a value of 5.3.0.0
>
> Thanks for any/all replies!
>
OS_VER=`awk 'f{print;exit}/Version\.Release\.Modification\.Fix/{f=1}' file`
Regards,
Ed.
|