1
#!/bin/bash
mkdir srcFrame
cd srcFrame
mkdir src
mkdir bin
mkdir lib
mkdir data
cd src
touch main.c
cd ..
cd lib
touch srcFrame.h
2
#!/bin/bash
grep '科技' phone.txt | cut -d
# -f2,4 | sort -t# -k1 > result.txt
3
#!/bin/bash
sort gdp.txt -t: -nk3 -r | head -n20 > tm.txt
4
#!/bin/bash
echo "what would you like to know about me?"
select question in name gender age nation college hometown high_school middle_school favorite_color favorite_things major quit
do
if [ $question = name ]
then
echo "My name is Yuanzhu."
elif [ "$question" = gender ]
then
echo "Male"
elif [ "$question" = age ]
then
echo "20"
elif [ "$question" = nation ]
then
echo "han"
elif [ "$question" = college ]
then
echo "BLCU"
elif [ "$question" = hometown ]
then
echo "Inner Mongolia"
elif [ "$question" = high_school ]
then
echo "Beishida jining fuzhong"
elif [ "$question" = middle_school ]
then
echo "Datong shizhong"
elif [ "$question" = favorite_color ]
then
echo "blue"
elif [ "$question" = favorite_things ]
then
echo "Music and Travel"
elif [ "$question" = major ]
then
echo "Computer Science and Technology"
elif [ "$question" = quit ]
then
echo "quit"
break
else
break
fi
done
5
!/bin/bash
grep "Beijing" corpus.txt > out.txt
6
#!/bin/bash
cut mails.txt -d@ -f2 | uniq -c > sortmail.txt
7
#!/bin/bash
for (( i=1; i<=1000; i++ ))
do
echo $i | md5sum | head -c 6 >>rubbish.txt
echo -n "@" >>rubbish.txt
echo $i | md5sum | head -c 4 >>rubbish.txt
echo ".com" >>rubbish.txt
done
8,9,10
#!/bin/bash
grep San psm.txt
grep "^J" datafile
grep "700$" datafile
grep -v "834" datafile
grep [:::]12[:/:] datafile 或者 grep '\:12\/'datafile
grep -i [a-z][[:blank:]]k datafile
sed -e 's/Jon/Jonathan/ datafile
sed -n '5,10p' datafile
sed -e '/Lane/d' datafile
sed -e 's/^Fred/***Fred/' datafile
cat datafile | grep Popeye | sed -e 's/3\/19\/35/11\/14\/46/'
sed -e '/^$/d' datafile
awk -F ":" '{print $1}' datafile | awk '{print $2}'|awk '/^D/'
awk -F ":" '{print $1}' datafile | awk '{print $1}'|awk '/^[CE]/'
awk -F ":" '{print $1}' datafile | awk '{if(length($1)==4)print $1}'
awk -F ":" '/\[916\]/{print $1}' datafile
awk -F ":" '{print $1}' datafile | awk '{print $2,",",$1}'