From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,5562e7cbf2805bb0 X-Google-Attributes: gidf8c9b,public X-Google-Thread: 1012a6,5562e7cbf2805bb0 X-Google-Attributes: gid1012a6,public X-Google-Thread: fee84,5562e7cbf2805bb0 X-Google-Attributes: gidfee84,public From: JGM_van_Ras Subject: Re: Need to format text records from a hugh file Date: 1999/06/28 Message-ID: <3777370E.90BEF952@best.ms.philips.com>#1/1 X-Deja-AN: 494697052 Cache-Post-Path: dibbs3.eur.cis.philips.com!unknown@nlms1s8.best.ms.philips.com Content-Transfer-Encoding: 7bit References: <7l73lr$8fl$1@nnrp1.deja.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@dibbs3.eur.cis.philips.com X-Trace: dibbs3.eur.cis.philips.com 930559786 20140 130.139.33.70 (28 Jun 1999 08:49:46 GMT) Organization: Philips Medical Systems X-Cache: nntpcache 2.3.2.1 (see http://www.nntpcache.org/) Mime-Version: 1.0 NNTP-Posting-Date: 28 Jun 1999 08:49:46 GMT Newsgroups: comp.unix.osf.osf1,comp.unix.questions,comp.unix.shell 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.