[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



Good deal.  I know you said not having to invoke AWK, but it's one of my 
favorite scripting languages, so I had to throw that one in.  I once 
wrote a language parser with AWK. :)

> 
> V/r
> 
> Bob
> 
> -----Original Message-----
> From: Geoffrey <esoteric at 3times25.net>
> Sent: Oct 11, 2005 11:37 AM
> To: Atlanta Linux Enthusiasts <ale at ale.org>
> Subject: Re: [ale] Bash script question
> 
> Bob Kruger wrote:
> 
>>All;
>>
>>I need to parse some simple text files.  I would like to do this in
>>the BASH shell and not have to invoke Perl, AWK, etc.  I did the same
>>a couple of years ago, but lost the code.
>>
>>If I have a text file that has, for example, 6 lines, and I want to
>>parse field in the 4th line, what can I run from the BASH shell to
>>print out only the 4th line?
> 
> 
> sed -n '4p' text_file
> 
> tail -4 text_file|line
> 
> head  -n4 text_file|tail -1
> 
> awk '{if (NR == 4) {print; exit}}' text_file
> 


-- 
Until later, Geoffrey


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00257" href="msg00257.html">[ale] Bash script question</a></strong>
<ul><li><em>From:</em> jkinney at localnetsolutions.com (James P. Kinney III)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00254" href="msg00254.html">[ale] Bash script question</a></strong>
<ul><li><em>From:</em> bkruger at mindspring.com (Bob Kruger)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00255.html">[ale] Enterprise Linux's</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00257.html">[ale] Bash script question</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00254.html">[ale] Bash script question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00257.html">[ale] Bash script question</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00256"><strong>Date</strong></a></li>
<li><a href="threads.html#00256"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>