RosettaCodeData/Task/Substring/UNIX-Shell/substring-4.sh
2023-07-01 13:44:08 -04:00

10 lines
230 B
Bash

#!/bin/sh
str=abcdefghijklmnopqrstuvwxyz
n=12
m=5
printf %s "$str" | cut -c $n-`expr $n + $m - 1`
printf %s "$str" | cut -c $n-
printf '%s\n' "${str%?}"
printf q%s "${str#*q}" | cut -c 1-$m
printf pq%s "${str#*pq}" | cut -c 1-$m