Tenth Line
franklinqin0 Shell
# Solution
# Using sed
This doc (opens new window) states that, "p"
is the print command. If sed
weren't started with an "-n"
option, the "p"
command would duplicate the input. The "-n"
option turns off printing unless you request it.
sed -n "10 p" file.txt
1
# Using awk
This doc (opens new window) states that, NR
is the number of records, or the line number.
awk 'NR==10{print; exit}' file.txt
1