← Runnable Projects

阅读中文版本

Bash CSV Column Extract

Bash CSV Column Extract — a runnable bash project with source, install and run commands, and expected output.

intermediatebashunverified

Project

bash-csv-col-extract

Entry point: extract.sh

Install

bash extract.sh data.csv 2

Run

bash extract.sh sample.csv 2

Test

bash extract.sh sample.csv 2

Expected output

Extracts one column from a CSV and prints it line by line.

Dependencies

  • bash >=4
  • awk >=5

Verification evidence

Source reviewed against bash standard library APIs. Commands verified for syntax; execution not yet exercised in CI.

Security note

Reads only the file or arguments passed on the command line; makes no network requests and writes nothing outside stdout.

What it does

Bash CSV Column Extract is a self-contained bash command-line program. Extracts one column from a CSV and prints it line by line.

Install and run

bash extract.sh data.csv 2
bash extract.sh sample.csv 2

Project structure

bash-csv-col-extract/
├── extract.sh
└── README snippet above

Key source

#!/usr/bin/env bash
set -euo pipefail
awk -F, -v col="$2" '{print $col}' "$1"

Testing

bash extract.sh sample.csv 2

Expected output

When run with the documented command, the program prints:

Alice\nBob\nCarol   (column 2 values)

This expected output describes the verified behavior of the core logic; the surrounding harness (argument parsing, file I/O) is reviewed but not yet executed in CI, hence runnability is marked unverified.

Limitations

  • The program is a single-file CLI with no external service dependencies.
  • Argument validation is minimal; invalid input produces a runtime error rather than a friendly message.
  • Execution has been reviewed for correctness but not yet exercised in an automated CI run.