LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 744|回复: 5

Written Assignment

[复制链接]
发表于 2004-2-29 12:09:28 | 显示全部楼层 |阅读模式
Write a command that lists all files in your home directory and the directories beneath it that end with the three letters “txt”, and also contain the word “code” somewhere in the path.


Write a command that removes all of the files specified in question 11.


Assume that there is a file named myFile in your home directory. Write a command that prints the file to the monitor, but replaces all instances of the character “e” with the character “x”.


Write a command that creates a file named myFileTwo, full of the same contents as myFile with all instances of the three character string “src” replaced with the six character string “source”.


The command “find . –type d” produces a list of all the subdirectories of the current directory. Write a command that print this list to a file named subdirectoriesFile, and also prints the list to the monitor. Before the list is printed to the monitor, however, remove any lines that contain the string “mail”.




Write a regular expression that matches any word that starts with a capital letter and ends with a period (“.”). Remember that regular expressions will attempt to make the longest possible match, so make sure that the regular expression will not allow capitol letters or periods inside the expression, just on their respective ends.


Describe the behavior of the following sed script. Pay careful attention to the space characters in the fourth line. Note that the 2 in the first line is not a regular expression. It is a line number.


2 d

/the/ d

s/[0-9]/number/g

s/ +/ /g
 楼主| 发表于 2004-3-1 10:41:57 | 显示全部楼层
大虾们, 帮下啦! 谢谢
发表于 2004-3-4 10:52:32 | 显示全部楼层
ls `find ~ -name \*code\*txt`


rm `find ~ -name \*code\*txt`

sed -e s/e/x/g myFile

sed -e s/src/source/g > myFileTwo
 楼主| 发表于 2004-3-4 12:00:49 | 显示全部楼层
大家来顶下啦! 再过几个小时后,我就要交了....

版主, 加油......
 楼主| 发表于 2004-3-4 15:11:13 | 显示全部楼层
1.find ~ -name *txt

2.find ~ -name *txt |xargs rm

3.sed -e s/e/x/g myFile

4. sed -e s/src/source/g > myFileTwo

5.find ~ -type d |tee subdirectoriesfile | sed /mail/d
  find ~ -type d >> subdirectoriesfile |sxargs sed /mail/d

6.^[A-Z].*.$

7. delete line 2
   delete the line have "the"
   replace 0-9 with number
   replace + with space
发表于 2004-4-13 16:29:03 | 显示全部楼层
1.find ~ -name *txt
是标准答案??我看有问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表