Abstract
The first cut
problem from HackerRank.
Cut 1#
Problem#
Given \(N\) lines of input, print the \(3rd\) character from each line as a new line of output. It is guaranteed that each of the lines of input will have a \(3rd\) character.
Input Format#
A text file containing \(N\) lines of ASCII characters.
Constraints#
\(1 \le N \le 100\)
Output Format#
For each line of input, print its character on a new line for a total of
lines of output.
Sample Input#
Hello
World
how are you
Sample Output#
l
r
w
Solution#
#!/usr/bin/env bash
# shellcheck disable=SC2162
while read line_txt; do
echo "${line_txt}" | cut -c 3
done