LoginSignup
34
27

More than 5 years have passed since last update.

catでファイルを連結するとき・・

Last updated at Posted at 2015-08-27
$ cat file1
This is file1.
$ cat file2
This is file2.

これらをcatで連結するときは

$ cat file1 file2 > file_all
$ cat file_all
This is file1.
This is file2.

とやりますが、途中でセパレートとか入れたいときは

$ cat file1 <(echo ---) file2 > file_all
$ cat file_all
This is file1.
---
This is file2.

などとできます。

転じて、サーバ間で設定ファイルを比較するときなど

$ diff /etc/postfix/main.cf <(ssh hostA cat /etc/postfix/main.cf)

なんてこともできます。

34
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
34
27