Linux实验报告二-vi编辑器的使用

上传人:文*** 文档编号:27146953 上传时间:2021-08-16 格式:DOCX 页数:7 大小:300.11KB
返回 下载 相关 举报
Linux实验报告二-vi编辑器的使用_第1页
第1页 / 共7页
Linux实验报告二-vi编辑器的使用_第2页
第2页 / 共7页
Linux实验报告二-vi编辑器的使用_第3页
第3页 / 共7页
点击查看更多>>
资源描述
西安邮电大学(计算机学院)课内实验报告实验名称: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 by pkg - vLn-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。2. 退出vi在命令方式下可有几种方法退出vi编辑器::wq把编辑缓冲区的内容写到你编辑的文件中,退出编辑器回到Linuxshell下。:ZZ仅当作过修改时才将缓冲区内容写到文件上。:x与:ZZ相同。:q!强行退出vi。感叹号(!)告诉vi ,无条件退出,丢弃缓冲区内容。这样,先前对该文件所做的修改或输入都被抛弃。3. 运行gcc file.c -o myfile编译该文件,发现错误,理解错误。4. 重新进入vi ,对该文件进行修改,然后存盘,退出 vi ,重新编译该文件,如果编译通过,用./my巾le 执行程序。5. 运行 man datefile10 , 然后 vi file10 。使用x, dd删除文本使用u命令恢复使用c, r, s等修改文本使用检索命令进行给定模式的检索。4、 实验截图1 .进入viVI-M Vi IM provedby Bran Moolenaar et aL2 .建立一个文件,输入 c语言程序,并含有错误File Edit View Stdrch TermiridL Help ? lfkcludest;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: Hissing terntnating character enabled by default printf (hello world! nr );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 5elmbubunruT 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*);晦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(hallo 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; selabgubjntui-S nan selabgubuntut-S cat DATE(l)dateftleio 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 dte.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 default) H hour。,Minutes* R * seconds *, or b ns for date and tine t。 the indicated preLlslon.,* -x efeence=FILE7.删除某些文本行$elqbubuntu; DATEtl)NAMEECRIPINem力菖周,user Cu i undsdate*STFtIMGdtsply tine described by string, not newF. -nie-DATEFILE like date ortce for edch line or datefile谑 1t. *埠 15.S9 O OATE(l) ITIMIE SPEC ( - tS0-8601TIMESPECoutput date/ttne in 150 BSHl format, TIME5PEC-1 date for datonly fthc default)( hours,1t seconds 11 or ns 1 fordte nd tine to the indicated preui写ion*-referenceiFILEdisplay the last modification 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 described by string not nowf, -file-DATfFTLE like -ge for puh 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.一 reference-FII Fdisplay rhe last nodlflcatlon tine 肝 file% - -rfc-2822iiLput date and tine tn RFC 1&22. fornat* Example: Mon o? Aug 12:34;56 -0600五、实验总结通过这次实验学会了使用 vi编辑器建立、编辑、显示以及加工处理文本文件。 对linux 的文本编辑器有了基本的认识, 体会到了使用键盘进行输入的效率性,为以后的linux系统使用打下了基础。
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 工作总结


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!