Linux command
rec2csv 命令
文件
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Convert recfile to CSV
rec2csv [file.rec] > [output.csv]
Select specific fields
rec2csv -f [field1,field2] [file.rec]
Select record type
rec2csv -t [Type] [file.rec]
Include header
rec2csv -H [file.rec]
说明
rec2csv converts GNU recutils plain-text database files into CSV format for import into spreadsheets, databases, or other tools that consume tabular data. It reads recfile records (structured as key-value pairs separated by blank lines) and outputs them as comma-separated rows with optional column headers via the -H flag. The -t flag selects a specific record type when a recfile contains multiple types, and -f limits output to specified fields. It can be combined with recsel in a pipeline to first filter records before converting to CSV. Part of the GNU recutils toolkit.
参数
- -t, --type _type_
- Select record type.
- -f, --fields _fields_
- Fields to output (comma-separated).
- -H, --headers
- Include column headers.
- -s, --sort _field_
- Sort by field.
- -n, --num _n_
- Limit number of records.
FAQ
What is the rec2csv command used for?
rec2csv converts GNU recutils plain-text database files into CSV format for import into spreadsheets, databases, or other tools that consume tabular data. It reads recfile records (structured as key-value pairs separated by blank lines) and outputs them as comma-separated rows with optional column headers via the -H flag. The -t flag selects a specific record type when a recfile contains multiple types, and -f limits output to specified fields. It can be combined with recsel in a pipeline to first filter records before converting to CSV. Part of the GNU recutils toolkit.
How do I run a basic rec2csv example?
Run `rec2csv [file.rec] > [output.csv]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -t, --type _type_ do in rec2csv?
Select record type.