Linux体系和编程 实验报告_第1页
Linux体系和编程 实验报告_第2页
Linux体系和编程 实验报告_第3页
Linux体系和编程 实验报告_第4页
全文预览已结束

下载本文档

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

文档简介

Linux体系和编程

实验报告

姓名学号

实验名称实验三:Linux编程

开设学期

开设时间

报告日期

评定成绩

awk编程(50分)

处理topl2.csv文件,下载命令:scpuserl@47.107.28.1:/tmp/top12.csv./(密

码userl)

[root@Mylinuxfin]#awk-ftopi2.awktopl2.csv

***2020CHINATOPI2PROVINCEGDPANALYSIS***

PROVINCEGDPPOPULATIONAVG_GDP(1CT5)

879

.

guangdong11076012601212

jiangsu1027198474.

乙20

shandong7312910152S01

zhejiang646136456553

.

henan549979937581

Sichuan485988367.52

hubei434435775S57

fujian439034154629

.

hunan417816644556

.

shanghai387002487634

.

anhui386806102649

beijing361022189.

***SUMMARY***

ThetotalGDPforthe12provinceis697425.

Thetotalpopulationforthe12provinceis83338.

TheavgGDPforthe12provinceis8.37.

***ADDITIONAL***

ThetoI1owingprovince'savgGDPgreaterthanallavqi:

guangdong--

---

——

——

---

beijing---16.49_

BEGIN,

i=O;

FS=*,tGDP=O;tPOP=O;avGDPH);

print"**»2020CHINATOPI2PROVINCEGDPANALYSIS*»*";

print"....................................................-..........-....................,;

printf('%12s%13s%13s%17s\n".*PROVINCE"."GOP"."POPULATION".*AVG_GDP(10^5),):

print"......................................................................................................................二•';

tGDP=tGDP4$2;

tP0P^tP0FHS3;

name[i]=$1;

gdp|i|=$2/$3;

i-Hl

printf("%12s%13d泡3d%17.2f\n",$1,$2,$3,$2/$3);

END{

avgGDP^GDP/tPOP;

print"............................................................................................................................

printf('%24s%8s?Ws\n',"****,"SUMMARY',"****);

print"..................................................................-------....................—---—--

printf("ThetotalGDPforthe12provinceis%d.\n*,tGDP);

printf("Thetotalpopulationforthe12provinceis%d.\n*,tPOP);

printf("TheavgGDPforthe12provinceis%.2f.\n'.avgGDP);

print............................................................................................................

printf("%24s%lls%4s\n','***1,1ADDIIIONAL',"***");

print"...........................................................................................................

printf("Thefollowingprovince'savgGDPisgreaterthanallavg(%.2f):\n",av

DP);

for(j=0;j<i;jH)

{

if(gdp[j]>=avgGDP)

(

printf('%s——%.2f\n",name[j],gdp[j]);

shell编程(50分)

编写一个脚本:path_summary.sh

l|root@Myl.inuxfinj#./pa:h_summary.sh/home/wrongpath

pathisnotvalid;/home/wrongpath

jroot@Mylinuxfinj#./pa-h_summary.sh/home/fin||||ll

Thesummaryinfoforpath:/home/fin

Filecount:101

Directorycount:112

Fileswithsize>1000

passwd2256

root1766

topl2,awk1245

i'.4

[root©Mylinuxfin]#./path_summary.sh/var/Tog3000H

Thesummaryinfoforpath:/var/logH

Filecount:67H

Directorycount:23■

Fileswithsize>3000M

'root^Mylinuxfin1h.,path_su-nnary.sh',etc

Thesummaryinfoforpath:/etc

Directory749

Filessize>

1245

|root@Mylinuxfin]#./pathsummary.sh/etc10000000

Thesummaryinfoforpath:/etc

Filecount:2547

Directorycount:749

Fileswithsize>100000C0

[root@Mylinuxfin]#./path_summary.sh/home/fin300

Thesummaryinfoforpath:/home/fin

Filecount:101

Directorycount:112

Fileswithsize>300

countfruit.sh351

list546

passwd2256

path_summary.sh542

root1766

root,pub394

topl2.awk1245

3024

letsize=i000;

温馨提示

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

评论

0/150

提交评论