๋ฐ์ํ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# Read from the file file.txt and output the tenth line to stdout.
#!/bin/sh
line_number=$(wc -l ./file.txt | awk '{print $1}')
#echo $(expr ${line_number})
cat ./file.txt | while read line
do
if [ ${line_number} -eq 10 ]
then
echo $(cat file.txt | sed -n 10p)
break
else
echo $(cat file.txt | sed -n 10p)
break
fi
done
|
cs |
728x90
๋ฐ์ํ
'๋ฏธ์ฌ์ฉ > ์๊ณ ๋ฆฌ์ฆ ์ ๋ฆฌ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[leetcode] shell - Valid Phone Numbers (0) | 2021.06.14 |
---|---|
[5/6] ํ๋ก๊ทธ๋๋ฐ๊ฐ์ 1์ผ์ฐจ (0) | 2021.05.02 |
ํจ์คํธ์บ ํผ์ค ์ด๊ฒฉ์ฐจ ์ฝ๋ฉํ ์คํธ ์๋ฐ ์๊ฐ์ ์ฒญ (2) | 2021.04.29 |