home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3732 < prev    next >
Encoding:
Internet Message Format  |  1992-09-01  |  3.1 KB

  1. Xref: sparky comp.unix.shell:3732 comp.unix.questions:10607
  2. Newsgroups: comp.unix.shell,comp.unix.questions
  3. Path: sparky!uunet!europa.asd.contel.com!gatech!cc.gatech.edu!news
  4. From: sougata@cc.gatech.edu (Sougata Mukherjea)
  5. Subject: Some Unix qs
  6. Message-ID: <1992Sep1.145646.1663@cc.gatech.edu>
  7. Sender: news@cc.gatech.edu
  8. Organization: College of Computing
  9. Date: Tue, 1 Sep 1992 14:56:46 GMT
  10. Lines: 60
  11.  
  12. This is from a friend. Please send all responses to him.
  13. Thanks,
  14. Sougata.
  15.  
  16. *****************************************************************************************
  17.  
  18. Hi Netters,
  19.  
  20.     I don't know if this is a FAQ problem as I haven't read the newsgroup
  21. in a while. However the problem goes as such - any pointers/suggestions/solutions would be highly appreciated. 
  22.  
  23.     I have a file say X which contains some records. These records are 
  24. fixed-format, single line ( each record ends with a NEWLINE character) and the
  25. record length extends upto 1600 characters. Each record contains information 
  26. about an ongoing project. Some fields in that record are project no, start-date
  27. project-director's name, budgeted amount etc. Some character positions may be
  28. blank too. 
  29.     This file is updated daily - new records may be added, existing records
  30. may be changed or deleted altogether. Suppose X1 represents yesterday's 
  31. instance of the file X and  X2 that of today. So the task is to find out the 
  32. following by comparing X1 and X2: 
  33.     (i) Which records have been added since yesterday ( i.e. records that 
  34. are present in file X2 but not in file X1)
  35.     (ii)Which records have not changed since yesterday ( i.e. records that 
  36. are common between  files X1 and X2 )
  37.     (iii) Which records have been deleted/changed since yesterday ( i.e. 
  38. records that are present in file X1 but not in file X2 )
  39.  
  40.     One solution for implementation in shell programming (ksh/SunOs Unix)
  41.  is to "sort" the data files X1 and X2 (based on primary key) and then use the 
  42. "comm" command.
  43. This has worked for files that have smaller record length.
  44.  
  45.     The problem I run into while applying the same technique to this
  46. file X is, that  when I apply the "comm" command to the sorted data files X1 and
  47. X2, each record breaks up (WHY ??) into multiple records (each of length 256
  48. characters).
  49.  
  50. My question is how do I perform the above operations [ (i), (ii) & (iii) ]
  51. without breaking a record into pieces. The output SHOULD preserve the 
  52. existing record format ( which "comm" does for small record lengths) and SHOULD NOT introduce extraneous characters in the output files. 
  53.  
  54.     Also, how do I read such a file with "vi" - as it says "Line too Long" ?
  55.  
  56. Please mail any responses to sm46@prism.gatech.edu or smishra@casbah.gatech.edu or post it in the news group.
  57.  
  58. Thanks a lot in advance !!
  59.  
  60. Somnath Mishra
  61.  
  62. ******************************************************************************************
  63.  
  64.  
  65.  
  66. ==============================================================================    
  67.   Sougata Mukherjea (sougata@cc.gatech.edu)
  68.   Graphics Visualization and Usability Center
  69.   College of Computing
  70.   Georgia Institute of Technology 
  71. =============================================================================
  72.