Certainly! For each file type—JSON, CSV, and YAML—let's identify the best tools for common use cases and provide a quick guide with syntax examples to get you started. ### JSON: `jq` **Installation**: Debian-based Linux: ```sh sudo apt-get install jq ``` **Common Use Case: Extracting Data** - Extract value(s) of a specific key: ```sh jq '.key' file.json ``` - Filter objects based on a condition: ```sh jq '.[] | select(.key == "value")' file.json ``` **Modifying Data**: - Modify a value: ```sh jq '.key = "new_value"' file.json ``` **Pretty-Printing**: - Format JSON file: ```sh jq '.' file.json ``` ### CSV: `csvkit` **Installation**: Debian-based Linux: ```sh sudo apt-get install csvkit ``` **Common Use Case: Analyzing Data** - Print CSV file with headers: ```sh csvlook file.csv ``` - Convert JSON to CSV: ```sh in2csv file.json > file.csv ``` **Filtering and Querying**: - Query CSV using SQL-like commands: ```sh csvsql --query "SELECT column FROM file WHERE column='value'" file.csv ``` **Combining and Exporting**: - Combine multiple CSV files: ```sh csvstack file1.csv file2.csv > combined.csv ``` ### YAML: `yq` (Version 4.x) **Installation**: Using pip: ```sh pip install yq ``` Note: This also installs `jq` because `yq` is a wrapper around `jq` for YAML files. **Common Use Case: Extracting Data** - Extract value(s) of a specific key: ```sh yq e '.key' file.yaml ``` - Filter objects based on a condition: ```sh yq e '.[] | select(.key == "value")' file.yaml ``` **Modifying Data**: - Modify a value: ```sh yq e '.key = "new_value"' -i file.yaml ``` **Conversion to JSON**: - Convert YAML to JSON: ```sh yq e -o=json file.yaml ``` ### Combining Tools in Workflows - While `jq` and `yq` cover JSON and YAML manipulation respectively, `csvkit` provides a robust set of utilities for CSV files. These tools can be combined in workflows; for example, converting CSV to JSON with `csvkit` and then manipulating the JSON with `jq`. - For Python developers, these command-line operations can complement the use of Python libraries like `json`, `csv`, and `PyYAML`, allowing for quick data format conversions or manipulations directly from the terminal. ### Summary This guide presents a focused tool for each data format—`jq` for JSON, `csvkit` for CSV, and `yq` for YAML—along with basic syntax for common tasks like data extraction, modification, and format conversion. Integrating these tools into your development workflow can significantly enhance your productivity and data manipulation capabilities directly from the command line.