Linux实验报告二-vi编辑器的使用_第1页
Linux实验报告二-vi编辑器的使用_第2页
Linux实验报告二-vi编辑器的使用_第3页
Linux实验报告二-vi编辑器的使用_第4页
Linux实验报告二-vi编辑器的使用_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、西安邮电大学(计算机学院)课内实验报告实验名称:vi编辑器专业名称:计算机科学与技术班 级:计科1405学生姓名:高宏伟学号(8 位)j04141152指导教师:刘霞林实验日期:2017年05月05日type;helpforinfornaticn:qto iexittype* help01rforon - linehelptype:help verstonit 上forverstoninfohururftlnq in vil copait ibl emodetypeiset nocpforvim defaultsihe lp cp- def aulttorinto onthishodlfled

2、 by pkg - v"ln-natntalners曜lists* alioth.debtan .orgil± open sombre? and rrwly distributabehelp poor childrentn uganda1、 实验目的学习使用vi编辑器建立、编辑、显示以及加工处理文本文件。2、 实验内容1 .进入和退出vi。2 .利用文本插入方式建立一个文件。3 .在新建的文本文件上移动光标。4 .对文本文件执行删除、复原、修改、替换操作。3、 实验步骤1. 进入vi在系统提示符($)下输入命令vi和想要编辑(建立)的文件名(如example),便可进入vi

3、。2. 退出vi在命令方式下可有几种方法退出vi编辑器::wq把编辑缓冲区的内容写到你编辑的文件中,退出编辑器回到linuxshell下。:zz仅当作过修改时才将缓冲区内容写到文件上。:x与:zz相同。:q!强行退出vi。感叹号(!)告诉vi ,无条件退出,丢弃缓冲区内容。这样,先前对该文件所做的修改或输入都被抛弃。3. 运行gcc file.c -o myfile编译该文件,发现错误,理解错误。4. 重新进入vi ,对该文件进行修改,然后存盘,退出 vi ,重新编译该文件,如果编译通过,用./my巾le 执行程序。5. 运行 man date>file10 , 然后 vi file10

4、 。使用x, dd删除文本使用u命令恢复使用c, r, s等修改文本使用检索命令进行给定模式的检索。4、 实验截图1 .进入vivi-m ' vi im provedby bran moolenaar et al«2 .建立一个文件,输入 c语言程序,并含有错误file edit view stdrch termiridl help ? lfkclude«st<lto * h*7 lines, 69 char dtlei sint natno ( printf(hello wo_ldln'); return 1;3 .运行gcc编译,查看报错信息9。皆

5、selabubjntui-s vl selabubuntu:-s vt selabubuntu:-s vt file.c seldb电ubuntwt is desktopdownloadsftte,c pictures templatesloe jr-ents exanples, desktop musicpublicvideosseldbqubuntws vl flie,c"labubuntugz file.t *t* nyflieftlw.u: in function lain':rtlv.c:5:b: error: 'hvll。' undec.idred

6、 (firil u&e ln thii* pr tntf (hello viorld! >afilec:5:b: note: each undeclared identifier is reported xcn it appeert tnfile*c:5:14: error: expected,)'before 1 world1 printf(hello worulvn");function)only cnce for edth furvct5启 labgubuntu:s: 14: ?rror; strity in progriefs:72: warning:

7、hissing terntnating ' character enabled by default printf (hello world! n'r );5:14: error: htsstng ttrnlnaflng charactfr " prtntf(hello world!n,);rtleic:7:1: error: expected before ()* token ) aselabubuntu:-$ |4 .重新修改正确程序5 .修改后再次执行程序,可以看到执行结果sclabbuntu; 逅.切 15:57 0seldb/ubunvt 5elmbubun

8、rut vi file.c selab电ubuntw-s is deiktcpoohnloadsfile,cpicturestenplatesdocuren ta妃k 曰 mplvs* desktophu5 t 匚publicvideos.selabubuntu:$ vi ftle.c mlibubuntu:-$ gcc file.e *o nyflle flit.c: in function 'min': file-c:5:a: errori * hello+ undeclared (first ost in this function)prtntf(hello worldn

9、*);晦ftle-c:5:8: note: each undeclared idcnttfter ts rfportcd1 only once for cah furxt ton it appears tn file.c:11 : error; expected boforc world prlntf(hello worldin");artle.c:5:14; error: strjy 'v tn pcogrdnrue,c:s:22: wd-ntng: nlsstng tecntntlng ' character enabled by default prlntf(h

10、allo worldlnr);af5;14; error; nissing ternxnating * character printf(hello world!n-);afile.c:7:1: error: expected *;r before *' taken .eldb电ubuntwt vl flle.c kelabubjntu!-$ gec file -o nyflle selabubuntiii-s */nyftle.hello world!/ 1 seldbubuntu:-$ |6 .把日期帮助写入file10,通过cat命令进行查看sc lab ubuntu; sela

11、bgubjntui-s nan selabgubuntut-s cat date(l)date>ftleio ftleieuser gonnandsdate(l)nahedaltsynopsis ddte date* printi?r the systen jdte dnd tineoption*.r *format-u | - 'utc| >-untwrsal nhddhhnhf ccyy .s&descriptiondisplay the current tine in the gwen format, or &et the system d«

12、te.waridfltory argument, to lonq options 和re mandatory for short options toq*d. -display fine dpscribrd by 弓thing, not ' naw-'ftle=tlatefil flike -date once for each line of dtefile-ittimespec, - -iso-86b1=time5pecoutput daie/ttne tft isg 86ai format. t1mespec=1 date' for dare only che d

13、efault) h 'hour。,minutes* r * seconds *, or b ns' for date and tine t。 the indicated prellslon.,* -x efe"ence=file7.删除某些文本行$elqbubuntu; datetl)nameecripinem力菖周,user cu i undsdate*stftimgdtsply tine described by string, not 'new'f. -nie-datefile like date ortce for edch line or d

14、atefile谑 1t. *埠 15.s9 o oate(l)' itimie spec ( - ts0-8601«timespecoutput date/ttne in 150 bshl format, time5pec-1 date' for dat«only fthc default)( 'hours',1t 'seconds 11 or 'ns 1 fordte nd tine to the indicated preui写ion*-referenceifiledisplay the last modification

15、 time of file-r, -rfc-2322output date and ttmr in f?fc z32z format* example: fionf qt aug 2006 12:3 : -etjo3-rfc-3339=timespec8.使用u命令恢复删除掉的文本sclabubuntu: dte(1 )nameecripintlate(l)user coinandsmdndvtory jrgunent tc long upliont dre ndriddlor for lihort options too.-d, -datestrincdisplay tire describ

16、ed by string± not 'nowf, -file-datfftle like -ge for p»uh line of dateflle-jtimespec, -'iso-afiftl=timfspfcoutput datf/tint in iso 白68format * tihespfc=1 date' far dte only (the defaul t) j ' hours ' t, ' seconds ' t ar ' ns ' fordate and tim to the indicated precision.一 ref

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论