Carve

carve

Extract a substring between two delimiters by ordinal position. Reads from stdin. Specify positions using short ordinals ('1st', '2nd', 'first', 'last') and delimiters.

Example

printf '%s\n' "a/b:c/d:e" | carve 2nd '/' to 3rd ':'

Arguments

  • ... (string): Parsing expression in the form: ORDINAL DELIM1 to ORDINAL DELIM2

Exit codes

  • 0: Always

Output on stdout

  • Carved substring