home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.shell:3732 comp.unix.questions:10607
- Newsgroups: comp.unix.shell,comp.unix.questions
- Path: sparky!uunet!europa.asd.contel.com!gatech!cc.gatech.edu!news
- From: sougata@cc.gatech.edu (Sougata Mukherjea)
- Subject: Some Unix qs
- Message-ID: <1992Sep1.145646.1663@cc.gatech.edu>
- Sender: news@cc.gatech.edu
- Organization: College of Computing
- Date: Tue, 1 Sep 1992 14:56:46 GMT
- Lines: 60
-
- This is from a friend. Please send all responses to him.
- Thanks,
- Sougata.
-
- *****************************************************************************************
-
- Hi Netters,
-
- I don't know if this is a FAQ problem as I haven't read the newsgroup
- in a while. However the problem goes as such - any pointers/suggestions/solutions would be highly appreciated.
-
- I have a file say X which contains some records. These records are
- fixed-format, single line ( each record ends with a NEWLINE character) and the
- record length extends upto 1600 characters. Each record contains information
- about an ongoing project. Some fields in that record are project no, start-date
- project-director's name, budgeted amount etc. Some character positions may be
- blank too.
- This file is updated daily - new records may be added, existing records
- may be changed or deleted altogether. Suppose X1 represents yesterday's
- instance of the file X and X2 that of today. So the task is to find out the
- following by comparing X1 and X2:
- (i) Which records have been added since yesterday ( i.e. records that
- are present in file X2 but not in file X1)
- (ii)Which records have not changed since yesterday ( i.e. records that
- are common between files X1 and X2 )
- (iii) Which records have been deleted/changed since yesterday ( i.e.
- records that are present in file X1 but not in file X2 )
-
- One solution for implementation in shell programming (ksh/SunOs Unix)
- is to "sort" the data files X1 and X2 (based on primary key) and then use the
- "comm" command.
- This has worked for files that have smaller record length.
-
- The problem I run into while applying the same technique to this
- file X is, that when I apply the "comm" command to the sorted data files X1 and
- X2, each record breaks up (WHY ??) into multiple records (each of length 256
- characters).
-
- My question is how do I perform the above operations [ (i), (ii) & (iii) ]
- without breaking a record into pieces. The output SHOULD preserve the
- existing record format ( which "comm" does for small record lengths) and SHOULD NOT introduce extraneous characters in the output files.
-
- Also, how do I read such a file with "vi" - as it says "Line too Long" ?
-
- Please mail any responses to sm46@prism.gatech.edu or smishra@casbah.gatech.edu or post it in the news group.
-
- Thanks a lot in advance !!
-
- Somnath Mishra
-
- ******************************************************************************************
-
-
-
- ==============================================================================
- Sougata Mukherjea (sougata@cc.gatech.edu)
- Graphics Visualization and Usability Center
- College of Computing
- Georgia Institute of Technology
- =============================================================================
-