Shell: substring the first 2 chars from a ${long} string: short=$(echo "${long}" | cut -c1-2) short=$(echo "${long}" | head -c2) short=$(echo "${long}" | awk '{print substr ($0, 0, 2)}' short=$(echo "${long}" | sed 's/^\(..\).*/\1/') — return to gimbo wiki home page