Jump to content
  • Advertisement
Sign in to follow this  
51mon

Append string from source to target in awk?

This topic is 3754 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I need to convert a script from one format to another. I have learned awk for the purpose. So far it has worked fine but now I've run into a thing I don't really know how to solve. I want to append the string between brackets ('{' and '}') in the source file to the target. The string can occupy multiple lines. Two examples: hdrBloomMotion []{0.64f, 0.87f, 0.98f} float sphericalH[] { 0.818459, 0.752063, 0.7539827, -0.049951, -0.066370, -0.066860, -0.199593, -0.110617, -0.030121, -0.042947, -0.039229, -0.034669, -0.102300, -0.058750, -0.015928, 0.036119, 0.028422, 0.020442 } How can I solve this in the best way? By the way is awk a good language/tool of choice when converting scrips to other formats? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Perl was written to augment the deficiencies of awk/sed scripts. That might be a good alternative. Depending on the complexity of the transformations, you could use tools like Lex/Flex and Yacc/Bison to parse one grammar, and emit another one.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!