Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Dear all, i'm new in the forum, hope to have some good discussions here in the future.
I have a question:
say I have a bunch of files with content as
H 1. 4.2601909824E-06 1.1192576765E-05 2.6002448261E-05
H 1. 1.9632681605E-06 1.8570567186E-05 2.1741537960E-05
H 1. -2.3238557216E-05 1.1226266025E-05 -2.3988312764E-05
H 1. -5.1073885199E-06 1.9570853306E-06 -1.6892426793E-05
H 1. 1.3239551190E-06 1.3856376369E-06 3.9292096947E-06
ENERGY IS -68.5097726137 E(NUC) IS 315.1972078453
1 1 3.38518644E-01-2.59345972E-02-2.20431415E-01 4.35677008E-02-1.73975464E-02
1 2 6.60042430E-02 7.22497090E-03 3.95542762E-03-2.04969589E-02-1.45090031E-02
1 3-7.56719858E-03-1.27150433E-02-2.50241943E-02 4.61303420E-02 2.11752109E-02
1 5-2.15259537E-03-1.43752716E-03-1.31201163E-03-4.27208217E-03 4.76034162E-02
1 6 2.24833277E-03-1.11268353E-02-9.74181047E-02-2.91626903E-02 8.74736584E-03
1 7-2.15400285E-02-3.40971482E-02 1.33311058E-02-7.77108704E-03-2.23749856E-03
1 8 1.63696613E-03-3.47066683E-03-4.05719853E-04-2.31927657E-03-2.53871570E-03
1 9 7.21058903E-06-6.35504509E-04-5.88477013E-04-8.31049017E-05 3.06961569E-04
1 10 5.15566010E-05-2.76245027E-04 1.04519661E-04-1.61330769E-04-2.85330037E-04
1 11 4.76965767E-04 1.65799220E-04-4.95788049E-04 4.01372143E-04-8.33988757E-05
1 12 3.52109490E-04-9.55040014E-05-1.80314085E-03-5.89478903E-03 3.75899269E-03
1 13 5.33075211E-04-5.54100430E-05 6.06786318E-05-7.18074009E-04 4.05424301E-03
1 14 3.88196151E-03 1.57004496E-04 3.12619608E-04 1.74230814E-04-1.23218799E-01
1 15 1.15067982E-01 4.50432329E-02-9.90256847E-02-3.18111872E-02 1.22994763E-01
1 16-7.57634741E-04 1.22495204E-03 4.19373998E-03
What I need is a way to get exactly the data inbetween (and including) the $HESS and subsequent $END keywords (and cat it to another file, but that I think I know how to do). The $HESS and $END keywords appear on indidual line numbers for all the files (but HESS appears only once in the file), so I have to find a way how to get the keyword. I know grep -A, but I dont know how much context I would need to give it in order to reach the next $END keyword.
I hope I could make my question clear enough, any helps on this would be very much appreciated.
thanks a lot. if i get it correctly, what your solution does is it runs over the whole file, when it meets the $HESS, it sets $I=1 (kind of as a switch), then it prints everything until it meets the first $END, where it sets $I to 0, and does no longer print the subsequent lines.cool.
thanks a lot. if i get it correctly, what your solution does is it runs over the whole file, when it meets the $HESS, it sets $I=1 (kind of as a switch), then it prints everything until it meets the first $END, where it sets $I to 0, and does no longer print the subsequent lines.
That's basically it, yep.
I'm pleased to know you found my post helpful. If you feel your question has been adequately answered then please consider using the thread tools to mark this thread solved.