


[20170705] Contents of diff comparison execution results.txt
[20170705]diff comparison execution result content.txt
--//Sometimes it is necessary to compare the output results of two commands. The stupid method is as follows, example:
$ lsnrctl status LISTENER_SCAN2 > /tmp/b2.txt
$ lsnrctl status LISTENER_SCAN3 > /tmp/b3.txt
$ diff -Nur /tmp/b2.txt /tmp/b3.txt
--//Obviously, this requires generating two files and then comparing them. In fact, it can be easily achieved using the shell.
$ lsnrctl status LISTENER_SCAN3 | diff /tmp/2.txt -
--//This reduces the generation of one file. Can it reduce the generation of files further?
$ diff <(lsnrctl status LISTENER_SCAN2) <(lsnrctl status LISTENER_SCAN3)
-- //How to understand?
$ echo <(lsnrctl status LISTENER_SCAN2) <(lsnrctl status LISTENER_SCAN3)
/dev/fd/63 /dev/fd/62
--//actually 62 ,63 is the open file handle. Of course, it will be closed immediately after execution.
$ ls -l /dev/fd
lrwxrwxrwx 1 root root 13 2014-12-11 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 2017-07 -05 16:16:07 3 -> /proc/101318/fd
--//Writing a simple shell script is easy to understand (note that this writing method is not very rigorous):
--//I directly read the contents of handle 63,62.
$ 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 30-JUN-2017 12:00:02 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)))
-- //Thinking of this, 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
The above is the detailed content of [20170705] Contents of diff comparison execution results.txt. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article explains how to use regular expressions (regex) in Linux for pattern matching, file searching, and text manipulation, detailing syntax, commands, and tools like grep, sed, and awk.

The article discusses using top, htop, and vmstat for monitoring Linux system performance, detailing their unique features and customization options for effective system management.

The article provides a guide on setting up two-factor authentication (2FA) for SSH on Linux using Google Authenticator, detailing installation, configuration, and troubleshooting steps. It highlights the security benefits of 2FA, such as enhanced sec

Article discusses managing software packages in Linux using apt, yum, and dnf, covering installation, updates, and removals. It compares their functionalities and suitability for different distributions.

The article explains how to manage sudo privileges in Linux, including granting, revoking, and best practices for security. Key focus is on editing /etc/sudoers safely and limiting access.Character count: 159

The article details the process of building and customizing a Linux distribution, covering choosing a base system, using build tools like LFS and Debian-based systems, customizing packages, and modifying the kernel. It also discusses managing softwar

The article provides a guide on configuring Linux networking, focusing on setting up static IP, DHCP, and DNS configurations. It details steps for editing configuration files and restarting network services to apply changes.

The article discusses popular Linux distributions: Ubuntu, Debian, Fedora, and CentOS, focusing on their unique features and suitability for different users. It compares Ubuntu and Debian's release cycles, software availability, and support, and high
