[shell][how-to] смешать два файла.

Ivan8209

"...Плывёт по волнам,
По волнам моей памяти..."
Исходно .
man 1 lam.
---
...Я работаю антинаучным аферистом...

sergey_m

Ну это специфично *BSD (может быть еще где есть). POSIX про такое не знает, у paste(1) такой функциональности нет.

Ivan8209

Очень странно.
У меня с помощью paste проходит.


jot `wc -l /etc/termcap | awk '{print $1;}'` 1 | paste -d"<LF>" - /etc/termcap | head


Я что-то не так делаю?
---
...Я работаю антинаучным аферистом...

dus1970

ага, jot жжОт, сиречь зажигает.

MariaS

cat inp1.txt inp2.txt > out.txt
Псекрету ВСЕМУ СВЕТУ

Ivan8209

А ты условия прочитал?
---
...Я работаю антинаучным аферистом...

sergey_m

И какое это имеет отношение к смешению двух файлов?

sergey_m

cat inp1.txt inp2.txt > out.txt
Садись, двойка.

Ivan8209

Смешивает.
Через строку.
---
...Я работаю антинаучным аферистом...

Ivan8209



bash-2.05b# paste -d"
" /etc/services /etc/termcap | head -50
> #
# Copyright (c) 1980, 1985, 1989, 1993
# Network services, Internet style
# The Regents of the University of California. All rights reserved.
#
#
# Note that it is presently the policy of IANA to assign a single well-known
# Redistribution and use in source and binary forms, with or without
# port number for both TCP and UDP; hence, most entries here have two entries
# modification, are permitted provided that the following conditions
# even if the protocol doesn't support UDP operations.
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# The latest IANA port assignments can be gotten from
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# http://www.iana.org/assignments/port-numbers
# notice, this list of conditions and the following disclaimer in the
#
# documentation and/or other materials provided with the distribution.
# The Well Known Ports are those from 0 through 1023.
# 3. All advertising materials mentioning features or use of this software
# The Registered Ports are those from 1024 through 49151
# must display the following acknowledgement:
# The Dynamic and/or Private Ports are those from 49152 through 65535
# This product includes software developed by the University of
#
# California, Berkeley and its contributors.
# Kerberos services are for Kerberos v4, and are unofficial. Sites running
# 4. Neither the name of the University nor the names of its contributors
# v5 should uncomment v5 entries and comment v4 entries.
# may be used to endorse or promote products derived from this software
#
# without specific prior written permission.
# $FreeBSD: src/etc/services,v 1.98 2003/10/08 08:48:43 bms Exp $
#
# From: @(#)services 5.8 (Berkeley) 5/9/91
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
#
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# WELL KNOWN PORT NUMBERS
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
rtmp 1/ddp #Routing Table Maintenance Protocol
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
tcpmux 1/tcp #TCP Port Service Multiplexer
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS


---
...Я работаю антинаучным аферистом...

sergey_m

И чем твоя конструкция с awkами и прочим лучше предложенной в конце изначального треде? Просто lam конечно будет быстрее всего, но не тройной конвейер с paste.
Короче вывод такой: самое лучшее решение lam, но он не описан в POSIX.

sergey_m

Ты прав. Посыпаю голову пеплом.
Оставить комментарий
Имя или ник:
Комментарий: