OPINION REQUEST: How do you want 'paste' to behave?
Dave Ihnat, Chicago, IL
ignatz at ihuxx.UUCP
Tue Aug 14 09:01:45 AEST 1984
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
More information about the Comp.unix.wizards
mailing list