Forrest logo
back to the textql tool

textql:tldr:11c4c

textql: Join two files on a specified common column.
$ textql -header -sql "SELECT * FROM ${file1} JOIN ${file2} ON ${file1}.${c1} = ${file2}.${c1} LIMIT ${10}" -output-header ${filename1-csv} ${filename2-csv}
try on your machine

This command is using the textql tool to execute a SQL query on two CSV files. Here is the breakdown of each part of the command:

  • textql: This is the command to run the textql tool.
  • -header: Specifies that the CSV files have a header row that contains the column names.
  • -sql "SELECT * FROM ${file1} JOIN ${file2} ON ${file1}.${c1} = ${file2}.${c1} LIMIT ${10}": Specifies the SQL query to execute. It selects all columns (*) from the two input CSV files (${file1} and ${file2}) and performs an inner join on the column ${c1} from both files. The LIMIT ${10} clause limits the output to the first 10 rows.
  • -output-header ${filename1-csv} ${filename2-csv}: Specifies the output file names for the joined result. ${filename1-csv} and ${filename2-csv} are placeholders that will be replaced with the actual file names.

In summary, this command is using textql to perform a join operation on two CSV files based on a specific column and outputting the result to new CSV files.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the textql tool