201720170705425content of the result of diffcomparison. txt, 20170705 diff
201720170705425content of the result of diffcomparison. txt
-- // Sometimes compare the output results of two commands. The stupid method is as follows, for example:
$ Lsnrctl status LISTENER_SCAN2>/tmp/b2.txt
$ Lsnrctl status LISTENER_SCAN3>/tmp/b3.txt
$ Diff-Nur/tmp/b2.txt/tmp/b3.txt
-- // It is obvious that two files need to be generated and compared. In fact, using shell can be very simple.
$ Lsnrctl status LISTENER_SCAN3 | diff/tmp/2.txt-
-- // Reduce the generation of one file. Can the generation of the file be reduced?
$ Diff <(lsnrctl status LISTENER_SCAN2) <(lsnrctl status LISTENER_SCAN3)
-- // How to understand it?
$ Echo <(lsnrctl status LISTENER_SCAN2) <(lsnrctl status LISTENER_SCAN3)
/Dev/fd/63/dev/fd/62
-- // Actually is the opened file handle. Of course, close immediately after execution.
$ Ls-l/dev/fd
Lrwxrwxrwx 1 root 13 02:24:57/dev/fd->/proc/self/fd
$ Ls-l/dev/fd/
Total 0
Lrwx ------ 1 grid oinstall 64 2017-07-05 16:16:07 0->/dev/pts/4
Lrwx ------ 1 grid oinstall 64 2017-07-05 16:16:07 1->/dev/pts/4
Lrwx ------ 1 grid oinstall 64 2017-07-05 16:16:07 2->/dev/pts/4
Lr-x ------ 1 grid oinstall 64 16:16:07 3->/proc/101318/fd
-- // Write a simple shell script to understand it very well (note that this writing method is not very rigorous ):
-- // I directly read the content of the handle.
$ Cat a. sh
#! /Bin/bash
Echo <(lsnrctl status LISTENER_SCAN2) <(lsnrctl status LISTENER_SCAN3)
Diff/dev/fd/63/dev/fd/62
$. A. sh
/Dev/fd/63/dev/fd/62
6c6
<Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = LISTENER_SCAN2 )))
---
> Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = LISTENER_SCAN3 )))
9c9
<Alias LISTENER_SCAN2
---
> Alias LISTENER_SCAN3
11, 12c11, 12
<Start Date 30-JUN-2017 12:00:03
<Uptime 5 days 4 hr. 18 min. 37 sec
---
> Start Date 30-JUN-2017 12:00:58
> Uptime 5 days 4 hr. 17 min. 43 sec
17c17
<Listener Log File/u01/app/11.2.0.4/grid/network/log/listener_scan2.log
---
> Listener Log File/u01/app/11.2.0.4/grid/network/log/listener_scan3.log
19, 20c19, 20
<(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = LISTENER_SCAN2 )))
<(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.100.109) (PORT = 1521 )))
---
> (DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = LISTENER_SCAN3 )))
> (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.100.107) (PORT = 1521 )))
-- // Here, I finally understand exp/imp on the fly. Example:
$ Exp scott/book file => (gzip> t.dmp.gz) tables = emp
$ Imp scott/book full = y file = <(gunzip <t.dmp.gz)