Abstract
The second cut problem from HackerRank.
Cut 2#
Problem#
Display the \(2^{nd}\) and \(7^{th}\) character from each line of text.
Input Format#
A text file with \(N\) lines of ASCII text only.
Constraints#
\(1 \le N \le 100\)
Output Format#
The output should contain \(N\) lines. Each line should contain just two characters at the \(2^{nd}\) and the \(7^{th}\) position of the corresponding input line.
Sample Input#
Hello
World
how are you
Sample Output#
e
o
oe
Solution#
#!/usr/bin/env bash
# shellcheck disable=SC2162
while read line_txt; do
echo "${line_txt}" | cut -c 2,7
done