Robert C. Kahlert wrote:

> File #1:
>    abc
>    def
>    ghi
>    jkl
>    mno
> 
>  
> File #2:
>    1
>    2
> 
>  Output of paste file1 file2
>  abc 1
>  def 2
>  ghi 1
>  jkl 2
>  mno 1

It can already be done with a combination of 'paste', 'cat', 'head', 'wc':

$ while :; do cat file2 || exit; done | head -n `wc -l < file1` | paste file1 -
abc     1
def     2
ghi     1
jkl     2
mno     1

If some new options were to be introduced for this use-case, it would be
preferrable to introduce two new, more widely applicable options:
  1) An option "paste --shortest" that causes 'paste' to terminate when one
     of the input files has reached its end,
  2) An option "yes -f FILE" or "cat --repeat FILE" that has the same effect as
       (while :; do cat file2 || exit; done)

The solution could then be written as

$ yes -f file2 | paste --shortest file1 -

Bruno



_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to