LinuxCommandLibrary

nth

extracts specific fields from input

TLDR

Extract nth field

$ echo "[a b c]" | nth [2]
copy
Extract from CSV
$ nth -d "," [1] < [file.csv]
copy
Extract multiple fields
$ nth [1] [3] [5] < [file.txt]
copy
Use custom delimiter
$ nth -d ":" [1] < [/etc/passwd]
copy

SYNOPSIS

nth [options] fields [file]

DESCRIPTION

nth extracts specific fields from input. Simple alternative to awk/cut.
The tool handles field extraction efficiently. Cleaner syntax than awk.

PARAMETERS

FIELDS

Field numbers to extract (1-indexed).
-d DELIMITER
Field delimiter (default: whitespace).
-0
Use null as output separator.
--help
Display help information.

CAVEATS

Field numbering starts at 1. Simpler than awk but less powerful.

HISTORY

nth provides simple field extraction as an alternative to awk and cut.

SEE ALSO

cut(1), awk(1), paste(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community