Strings In Depth6 / 17
Up next

Extract fields with cut

#!/usr/bin/env bash
line="ada:1815:london"
# -d sets the delimiter, -f picks fields (1-indexed)
echo "$line" | cut -d: -f1
echo "$line" | cut -d: -f2,3
What you're solving

cut selects columns by delimiter