.. _filtVert: Filtering Vertically --------------------- .. seealso:: * Video about `Filtering Data Vertically with Cut and Awk `_ .. _cut: cut ^^^^ .. program:: cut .. describe:: cut Print selected parts of lines from each FILE to standard output. :command:`cut` can also read data from stdin (usually via a pipe). SYNOPSIS cut [OPTION]... [FILE]... .. cmdoption:: -d, --delimiter=DELIM Use DELIM instead of TAB for field delimiter .. cmdoption:: -f, --fields=LIST Select only these fields; also print any line that contains no delimiter character, unless the -s option is specified awk ^^^ .. sidebar:: Alternatives If :ref:`awk` is to be considered for filtering data, also consider Perl and Python, which are general purpose scripting languages with excellent string processing capabilities. See :ref:`vert_awk` .. _paste: paste ^^^^^^ .. index:: paste .. program:: paste .. describe:: paste Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output. With no FILE, or when FILE is -, read standard input. The :command:`paste` command is sort of the opposite of :command:`cut`. The :command:`cut` command filters vertical data (columns) from the data and :command:`paste` takes columns of data from separate files and put them together. SYNOPSIS :command:`paste` [OPTION]... [FILE]... .. option:: -d, --delimiters=LIST reuse characters from LIST instead of TABs .. option:: -s, --serial paste one file at a time instead of in parallel Files contain the desired columns and :command:`paste` merges the columns. :: $ getent passwd | tail -5 | cut -d: -f3 > field3 $ getent passwd | tail -5 | cut -d: -f7 > field7 $ paste -d: field3 field7 558:/bin/bash 559:/bin/bash 560:/bin/bash 561:/bin/bash 562:/bin/bash