Skip to content

Commit 8712e90

Browse files
committed
Update tenth-line.sh
1 parent 226553e commit 8712e90

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Shell/tenth-line.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,13 @@
2323
# 2. There's at least three different solutions. Try to explore all possibilities.
2424
#
2525
# Read from the file file.txt and output the tenth line to stdout.
26+
27+
# Solution 1
2628
awk '{if(NR==10) print $0}' file.txt
29+
awk 'NR == 10' file.txt
30+
31+
# Solution 2
32+
sed -n 10p file.txt
33+
34+
# Solution 3
35+
tail -n+10 file.txt | head -1

0 commit comments

Comments
 (0)