[102397] in RedHat Linux List
RE: parsing text files
daemon@ATHENA.MIT.EDU (Ed Lazor)
Wed Dec 2 19:16:28 1998
From: "Ed Lazor" <elazor@hcs.state.or.us>
To: <redhat-list@redhat.com>
Date: Wed, 2 Dec 1998 16:14:08 -0800
In-Reply-To: <199812022150.PAA28404@ftms.ftms.com>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
>Won't work.
You're right and you're wrong. It turns out that the column of
information I was actually pulling information from only had one
word - so I lucked out *grin*. This wouldn't have worked in the
example I gave though if I were trying to pull the person's last
and first name because they are separate words and would have been
parsed into separate variables. So out of curiosity, how would
have you gone about separating the column if it had multiple
words and the number of words varied?
>Each and every space acts as a column separator, which means
>that the first "human" column, which contains the person's name, can have
more
>than one name there. So that means that $2 could be the person's first or
>last name (depending if the file is first last or last, first). If there
is
>a third part of the person's name, the address column may not start until
$4,
>instead of $3.
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com http://archive.redhat.com
To unsubscribe: mail redhat-list-request@redhat.com with
"unsubscribe" as the Subject.