1. 用vi编写一个文档test.txt,将其存放在用户在用户主目录下,内容如下:
Plagiarism is breach of Integrity.It is a form of cheating in assessment and may occur in oral,written or visual presentations.
Plagiarism covers a of inappropriate behaviours,includeing:
failure to properly document a source Collusion between students or other people or tutors Copying another student’s work
Purchasing pre-written or on-demand papers from the numerous paper mills and cheat sites Submitting work that you have previously submitted for another course
(1) 将此文件另存为test2.txt,将其存放在用户主目录中。
先使用vi编辑器编辑test.txt在使用mv命令修改其名称
最后使用mv移动到用户主目录中
(2) 第一行缺少一个单词Academic,将它加到单词Intergrity的前面。
(3) 第三行的varity少了一个e,应改为variety,请改正。
(4) failure的但一个字母应为大写F,请改正。
![linux中vi编辑器的练习心得](https://www.gzhxs.cn/wp-content/uploads/2023/02/58762.webp)
(5) 将倒数第一,第二行的顺序颠倒过来(用复制和粘贴功能)。
(6) 删除包含Collusion的那一行。
(7) 将/etc/passwd文件的内容读入到文章的结尾处。
(8) 有一个扩展命令可以快速地实现全部替换操作,现用此命令将所有的单词Plagiarism替换为PLAGIARISM,命令如下:
:1,$s/Plagiarism/PLAGIARISM/g
(9) 撤销上一操作(用命令 u),用下面的命令实现替换,每一次替换时需要用户确认。命令如下:
:1,$s/Plagiarism/PLAGIARISM/gc
(10) 检查修改是否正确,确认无误后保存文件并退出。
以上就是本篇文章关于vi编辑器的练习心得的全部内容,希望我们的整理对你有用。