[PLUG-Devel] Process text records
James Crawford
jrefl5 at gmail.com
Sat Nov 17 20:06:09 MST 2007
Joey,
This realy sounds more like a perl/python type job
>Date: Sat, 17 Nov 2007 07:56:32 -0700
>From: Joey Prestia <joey at linuxamd.com>
>Subject: [PLUG-Devel] Process text records
>To: plug-devel at lists.PLUG.phoenix.az.us
>Message-ID: <473F0120.4080906 at linuxamd.com>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>I am having problems trying to pull paragraphs out of a text file in
>bash. The text file is several hundred pages long and consists of
>paragraphs with newline characters. And the only thing I can use for a
>field separator is a blank line any ideas on how I be able to accomplish
>this? I have tried using sed and tr to process the file and basically
>tried this:
>#!/bin/bash
>sed 's/^$/@/g' text > text.out
>for i in `seq 1 100` ; do
> cut -d@ -f$i text.out > string
> file=`cat string`
> echo $file | mail -s "Your data" user at domain.com
>done
>
>because of the newline characters I get bad results. I have been using
>README file in /usr/share/doc to try to get this right but the newlines
>throw the results wacky if I tr them out and if I leave them in the
>fields come up wrong because of the \n characters.
>
>Thanks for your time.
>
>Joey Prestia
>Joey at linuxamd.com
James Crawford
More information about the PLUG-devel
mailing list