[ale] Bash script question

Bob Kruger bkruger at mindspring.com
Tue Oct 11 14:28:39 EDT 2005


That worked.

Thanks, Geoff.

V/r

Bob

-----Original Message-----
From: Geoffrey <esoteric at 3times25.net>
To: ale at ale.org
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
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list