merge

Functions

int main(int argc, char *argv[])

merge [ option ] file1 [ infile ]

  • -s int

    • insert point \((0 \le S \le L_1)\)

  • -l int

    • frame length of input data \((1 \le L_1)\)

  • -m int

    • order of input data \((0 \le L_1 - 1)\)

  • -L int

    • frame length of output data \((1 \le L_2)\)

  • -M int

    • order of output data \((0 \le L_2 - 1)\)

  • -q int

    • input format

      • 0 naive

      • 1 recursive

  • -w

    • overwrite mode

  • +type char

    • data type

      • c char (1byte)

      • C unsigned char (1byte)

      • s short (2byte)

      • S unsigned short (2byte)

      • h int (3byte)

      • H unsigned int (3byte)

      • i int (4byte)

      • I unsigned int (4byte)

      • l long (8byte)

      • L unsigned long (8byte)

      • f float (4byte)

      • d double (8byte)

      • e long double (16byte)

  • file1 str

    • insert data sequence

  • infile str

    • input data sequence

  • stdout

    • merged data sequence

This command merges two data sequence in a frame-by-frame manner. The below figure shows the overview of the command.

../_images/merge_1.png

Insert mode example:

echo 1 1 2 2 3 3 | x2x +as > input.s
echo 4 5 6 7 | x2x +as > insert.s
merge -s 2 -l 2 -L 1 +s insert.s < input.s | x2x +sa
# 1, 1, 4, 2, 2, 5, 3, 3, 6

Overwrite mode example:

echo 1 1 2 2 3 3 | x2x +as > input.s
echo 4 5 6 7 | x2x +as > insert.s
merge -w -s 0 -l 2 -L 1 +s insert.s < input.s | x2x +sa
# 4, 1, 5, 2, 6, 3

Recursive mode example:

echo 1 1 2 2 3 3 | x2x +as > input.s
echo 4 | x2x +as > insert.s
merge -q 1 -s 0 -l 2 -L 1 +s insert.s < input.s | x2x +sa
# 4, 1, 1, 4, 2, 2, 4, 3, 3
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

bcp