Quote:
Originally Posted by
countryStyle
See....you did not need data to answer and there was no problem adding on the excellent commentary/lead about awk.
If I lucked out into something that did exactly what you wanted the very first try, then I lucked out. Getting people to explain what they really want can be as difficult as -- well -- as difficult as getting you to post your data.
Simple questions shouldn't always be taken at face value, either
Quote:
Originally Posted by qdb.us
<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"
<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers
So frequent posters here develop some habitual questions. 1) Post your OS (thank you for that), 2) Post your data! It makes things a lot smoother all around.
Quote:
I know a lot of people often ask for the answer to their specific issue and want YOU the other poster to do all the work for them (sometimes very practical). I am still at the general question looking to get more of a clue phase but if you want to do all my work for me let me know...I am certain you can do it fast.
You know the saying, a bird in the hand is worth two in the bush? It doesn't have to be either/or. I can make a simple example that works with your data without doing all your work for you, which will look more straighforward than one for random data I had lying around.
Quote:
I am not working with large files here and performance is not an issue...... The line is easy to use and works in the Bash shell so....why is this a silly solution, performance, crossplatform issues?
Running one program instead of two is much better, and if you can avoid
any programs, that's better yet! External programs take time to start and stop, even for tiny files -- especially for tiny files, where most of the time would be spent loading/quitting instead of work. And pipes can waste time communicating with each other (grep reads, writes, tail reads, writes, head reads, writes.) Both of these can add up faster than you'd expect. One of my first shell programming experiments was a text linewrapper that ran at the blazing speed of one kilobyte per second.
This is also why I'm curious what your program actually is and how you're using this 'get line x' code, because if grep | tail | head is your way of loading individual lines of data from file, you might want to ask about better ways to organize your program.