From: JGM_van_Ras <jvras@best.ms.philips.com>
Subject: Re: Need to format text records from a hugh file
Date: 1999/06/28 [thread overview]
Message-ID: <3777370E.90BEF952@best.ms.philips.com> (raw)
In-Reply-To: 7l73lr$8fl$1@nnrp1.deja.com
With sed and awk command :
cat inputfile sed "s/;//g" |awk '{printf("%-8s%-33s%-54s%-59s\n",$1," "$2," "$3," "$4)}' > outputfile
Good luck
*** Philips Medical Systems Netherlands
*** System Dev. Cardio/Vascular
*** Hardware, Librarian & Support Unix
*** The Netherlands
*** mailto:jos@jgmvanras.demon.nl
*** Homepage:http://www.jgmvanras.demon.nl/
wli@cincom.com wrote:
> Hi,
>
> I wonder if someone can help me on the following problem.
>
> I have an export file with 4 fields in each record i.e.
>
> AAAAAAA ; BBBBBBBBB ; C ; DDD
> AAAA ; BBBBBB ; CCCCCC ; D
>
> and I need to reformat the records by removing the ";" with the
> following condition
>
> 1. A field starts from 1st col. to 7th col.
> 2. B field starts from 8th col. to 34th col.
> 3. C field starts from 35th col. to 55th col.
> 4. D field starts from 55th col. to 60th col.
>
> If the text is less that the length of field, space (from space bar)
> will be appended to the end of that field.
>
> Is there a simple way that I can do it with "vi" or is there any tools
> or script that I can do that?
>
> The file has 200000 records and I just can't afford to change them one
> by one and I need it quite urgent.
>
> Thanks in advanced for any help.
> William
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
prev parent reply other threads:[~1999-06-28 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-28 4:00 Need to format text records from a hugh file wli
1999-06-28 4:00 ` JGM_van_Ras [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox