Fill-in the following sections with either English or Chinese.
In your submission email, you may deliver (1) your source code (packed in one file or shared in a netdisk link) (2) PDF version of this report
Remove these comments when writing your report
姓名:谢志彬_
学号:6103115112_
邮箱地址:____siliconx@163.com
专业班级:____计算机科学与技术153
实验日期:_________2018/04/09 ___
课程名称:________Linux程序设计实验____
##实验项目名称
##实验目的
##实验基础
##实验步骤
#!/bin/sh
if [ $# != 3 ]; then
echo "USAGE: $0 FILENAME FROM(int) TO(int)"
exit 1
fi
echo "FILENAE: $1"
echo "FROM: $2"
echo "TO: $3"
echo "================ target text ================"
cat $1 | head -n $3 | tail -n +$2
echo "\n==================== done ===================="
#!/bin/sh
if [ $# != 2 ]; then
echo "ARGS ERROR"
echo "USAGE: $0 FILENAME TARGET_WORD"
exit 1
fi
echo "FILENAME: $1"
echo "TARGET WORD: $2"
echo "================ original text ================"
more $1
echo "================ new text ================"
sed -e "/$2/d" $1 > $1.witout-$2
more $1.witout-$2
#!/bin/sh
# reference https://blog.csdn.net/beyondlpf/article/details/46426513
find -type f -perm -700
#!/bin/sh
for i in $@; do
if [ -f $i ]; then
# wc -- get the number of lines of a file
echo $i 'is a FILE, LINES:' `wc -l < $i`
elif [ -d $i ]; then
echo $i 'is a DIR'
else
echo $i 'NOTFOUND'
fi
done
#!/bin/bash
# present the result in a form of matrix
# ROW: each file
# COL: occurrence of each word
printf "WORD \ FILE"
for i in $@; do
printf "%11s" $i
done
echo
for word in $(<$1); do # read words_file word by word
printf "%11s" $word
for i in $@; do # counting
printf "%11s" `grep -w "$word" $i | wc -l`
done
echo
done
#!/bin/bash
ls -d */ # list dir only
#!/bin/bash
# `seq` gen expression, `bc` calculating
seq -s "*" $1 | bc
##实验数据或结果
##实验思考
##参考资料