ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • merge lines of file by using paste
    Computer/linux 2013. 3. 19. 19:53

    Linux is always so powerful to do something, in my life. And it makes my life ease...

    Sometimes, I need a special tool to merge two or multiple files into a file. So here is the

    neat solution for that.

    $ more {1,2}.dat
    ::::::::::::::
    1.dat
    ::::::::::::::
    1
    2
    3
    ::::::::::::::
    2.dat
    ::::::::::::::
    A
    B
    C
    $ paste  {1,2}.dat
    1       A
    2       B
    3       C
    $ paste  -d" " {1,2}.dat
    1 A
    2 B
    3 C
    $ paste  -d"," {1,2}.dat
    1,A
    2,B
    3,C

    $ paste  *.dat
    1       A
    2       B
    3       C


    PASTE(1)                             User Commands                             PASTE(1)

    NAME
           paste - merge lines of files

    SYNOPSIS
           paste [OPTION]... [FILE]...

    DESCRIPTION
           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.

           Mandatory arguments to long options are mandatory for short options too.

           -d, --delimiters=LIST
                  reuse characters from LIST instead of TABs

           -s, --serial
                  paste one file at a time instead of in parallel

           --help display this help and exit

           --version
                  output version information and exit

    AUTHOR
           Written by David M. Ihnat and David MacKenzie.




    댓글

Designed by Tistory.