Home > linux > bash > BashReversedPipe | About

the command1 <(command2) syntax is equivalent to command2 | command1, it's like a reversed pipe. See in this example how the two sort and uniq operations and have the same results. First, let's print the file we're going to work on :

ychaouche@ychaouche-PC ~/DOWNLOADS/CODE/LOGTOP/logtop-master $ cat setup.py 
#!/usr/bin/env python

"""
setup.py file for logtop
"""

from distutils.core import setup, Extension


logtop_module = Extension('_logtop',
                           sources=['logtop_wrap.c',
                                    'src/logtop.c',
                                    'src/avl.c',
                                    'src/history.c',
                                    'src/libavl/avl.c']
                           )

setup (name = 'logtop',
       version = '0.2',
       author      = "Julien Palard",
       description = """Live line frequency analyzer""",
       ext_modules = [logtop_module],
       py_modules = ["logtop"],
       )
ychaouche@ychaouche-PC ~/DOWNLOADS/CODE/LOGTOP/logtop-master $ 

Now let's the do the normal pipe thing : sort file | uniq

ychaouche@ychaouche-PC ~/DOWNLOADS/CODE/LOGTOP/logtop-master $ sort setup.py  | uniq

                           )
       )
"""
       author      = "Julien Palard",
       description = """Live line frequency analyzer""",
       ext_modules = [logtop_module],
from distutils.core import setup, Extension
logtop_module = Extension('_logtop',
       py_modules = ["logtop"],
setup (name = 'logtop',
setup.py file for logtop
                           sources=['logtop_wrap.c',
                                    'src/avl.c',
                                    'src/history.c',
                                    'src/libavl/avl.c']
                                    'src/logtop.c',
#!/usr/bin/env python
       version = '0.2',
ychaouche@ychaouche-PC ~/DOWNLOADS/CODE/LOGTOP/logtop-master $

And the other way around : uniq <(sort file)

ychaouche@ychaouche-PC ~/DOWNLOADS/CODE/LOGTOP/logtop-master $ uniq <(sort setup.py) 

                           )
       )
"""
       author      = "Julien Palard",
       description = """Live line frequency analyzer""",
       ext_modules = [logtop_module],
from distutils.core import setup, Extension
logtop_module = Extension('_logtop',
       py_modules = ["logtop"],
setup (name = 'logtop',
setup.py file for logtop
                           sources=['logtop_wrap.c',
                                    'src/avl.c',
                                    'src/history.c',
                                    'src/libavl/avl.c']
                                    'src/logtop.c',
#!/usr/bin/env python
       version = '0.2',
ychaouche@ychaouche-PC ~/DOWNLOADS/CODE/LOGTOP/logtop-master $

contact : @ychaouche yacinechaouche at yahoocom


QR Code
QR Code bashreversedpipe (generated for current page)