ignatz@ihuxx.UUCP (Dave Ihnat, Chicago, IL) (08/14/84)
Hello, folks. Having recently finished 'cut', I've decided to go on and do the companion command, 'paste'. Where 'cut' disassembles a file, 'paste'--predictably--will put files together in one file. For instance, if you have two files, file1 and file2; file1 contains File1,line 1 File1,line 2 File1,line 3 File1,line 4 File1,line 5 and file2 contains File2,line 1 File2,line 2 File2,line 3 File2,line 4 File2,line 5 Then, if you ran the command "paste file1 file2 >file.both", file.both will contain: File1,line 1 File2,line 1 File1,line 2 File2,line 2 File1,line 3 File2,line 3 File1,line 4 File2,line 4 File1,line 5 File2,line 5 with the lines separated by a 'tab' by default. The problem, for me, comes with the old question: How closely do I emulate the behavior of the original command? You see, I've encountered what appears to be a bug that's never been fixed (What? In a Unix(Tm) command?? How extraordinary!!). Unfortunately, it lives in that funny realm of bugs that someone may use for some reason. One of the 'paste' options, '-s', replaces the function of an *old* command of the same name, which simply joined all the lines of a file. This, 'paste -s file1 >filex' would result in a filex that looks like: File1,line 1 File1,line 2 File1,line 3 File1,line 4 File1,line 5 with each of the old lines 'tab' separated, and a newline at the end. (Think of doing a series of 'J' commands in vi--the effect is similar.) Problem? Simply that the manual documents that you can invoke the last form as 'paste -s file1 file2 ...', that is, stating explicitly that you may paste together several files. For the command 'paste -s file1 file2 file3 >file.out' You would, then, expect an output like (assume files like 'file1' and 'file2' above, but only three lines): File1,line 1 File1,line 2 File1,line 3 File2,line 1 File2,line 2 File2,line 3 File3,line 1 File3,line 2 File3,line 3 What you *actually* get, however, is: File1,line 1 File1,line 2 File1,line 3 File1,line 1 File1,line 2 File1,line 3 File2,line 1 File2,line 2 File2,line 3 File1,line 1 File1,line 2 File1,line 3 File2,line 1 File2,line 2 File2,line 3 File3,line 1 File3,line 2 File3,line 3 This looks, to me, like someone forgot to reset a buffer pointer for multiple files. BUT: Do I fix the bug in the version I'm going to release? Or do I keep it, so that I look like the Unix version? How about it, old Unix hands? Did anyone ever use this behavior? What do you want? Sorry if this is long-winded, but I couldn't think of how to explain it in any more abbreviated manner. Please respond by mail; any flames, of course, go to /dev/fireplace. I'll make my decision within a couple of weeks. Dave Ihnat ihuxx!ignatz
boylan@dicomed.UUCP (Chris Boylan) (08/26/84)
Is there something more to cut and paste than present in the preceeding articles on said programs? It would seem that they are done with ease using awk or lam. Certainly the example from what I am following up on is straight out of the lam documentation... -- Chris Boylan {mgnetp | ihnp4 | uwvax}!dicomed!boylan