Skip to main content

cat

The cat command concatenates multiple CSV files into one.

Syntax

qsv cat [options] [<input_files>...]

Description

The cat command is used to combine multiple CSV files into a single file. This is useful for merging data from different sources or splitting a large file into smaller ones.

Options

  • -h, --header: Include headers from the first file
  • -v, --vertical: Concatenate files vertically (by row)
  • -H, --horizontal: Concatenate files horizontally (by column)
  • -n, --no-headers: Exclude headers from the output

Examples

Vertical Concatenation

Concatenate two CSV files vertically:

qsv cat -v file1.csv file2.csv | qsv table

Output:

# Combined data from file1.csv and file2.csv

Horizontal Concatenation

Concatenate two CSV files horizontally:

qsv cat -H file1.csv file2.csv | qsv table

Output:

# Combined data from file1.csv and file2.csv

Common Use Cases

  • Merging data from multiple sources
  • Splitting a large file into smaller ones
  • Combining data from different systems or formats

Tips

  • Use -h to include headers from the first file
  • Use -n to exclude headers from the output
  • Be cautious when concatenating files with different structures or formats

See Also

  • select - for selecting specific columns after concatenation
  • behead - for removing headers from a CSV file