[102406] in RedHat Linux List
Re: parsing text files
daemon@ATHENA.MIT.EDU (Jan Carlson)
Wed Dec 2 20:33:49 1998
Date: Wed, 02 Dec 1998 20:14:50 -0500
From: Jan Carlson <janc@iname.com>
To: redhat-list@redhat.com
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
Ed Lazor wrote:
> Is there a unix command that I can use to parse a column of text from a
> file?
Yes, several. Cut, paste, sed, ed, vi, emacs, perl, awk, gawk for starters.
The simplest is cut. It can be used if there is a unique column separator
character, or if each column has a fixed width padded with blanks.
The cut man page will help.
$ man cut
If the table has mixed tabs, blanks, etc in the whitespace, its harder.
>
> For example, a command that would allow me to parse the column titled
> address
> from a file with the following information and output it to another file?
>
> Name Address Town
> bob 123 A st. Somewhere
> steve 123 B st. Somewhere
> joe 123 C st. Somewhere
> gloria 123 D st. Somewhere
>
> --
> 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.
--
Jan Carlson
janc@iname.com Scarborough, Ontario, Canada
Mailed with Netscape 4.5 on Red Hat Linux 5.2
--
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.