如何使用Shell Script从Linux的Excel工作表中读取数据? [英] How to read data from Excel sheet in Linux using Shell Script?

查看:1439
本文介绍了如何使用Shell Script从Linux的Excel工作表中读取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个人, 我是Linux&的新手.非常有兴趣编写shell脚本.这次我正在制作一张excel表格.在该Excel工作表中将有S.No.在第一栏域名在第二栏中.我的Excel工作表中有100个域.因此,我不想手动复制每个域&将它们粘贴到浏览器中以检查所有内容.我只想编写一个Shell脚本,通过运行单个Shell脚本可以将所有域打开到浏览器中. 请帮帮我.我将非常感谢您.

EveryOne, I am new in Linux & very much interested to write shell scripts. This time I am making a excel sheet. In that excel sheet there will be S.No. in 1st column & Domain names in second column. There are 100 of domains in my excel sheet. So, I do not want to manually copy every domain & paste them into browser to check all. I simply want to write a shell script which can open all the domains into browser by running the single shell script. Please help me out. I will be very grateful to you.

感谢&问候- Reetesh Chauhan

Thanks & Regards- Reetesh Chauhan

推荐答案

xls2csv会将您的xls文件转换为CSV格式.

xls2csv will get your xls file into a CSV format.

将其放在sed上以删除双引号.

Pipe that to sed to remove the double-quotes.

使用while遍历每行.

echo每行(l)到awk,将第二个($2)列放入$d(对于域)变量.

echo each line (l) to awk to get the second ($2) column into the $d (for domain) variable.

然后将其发送到浏览器.您可以将lynx替换为您喜欢的浏览器. GUI浏览器将像TUI一样容易地工作.

Then send that to browser. You can replace lynx with your favorite browser. A GUI browser will work as easily as a TUI one.

xls2csv domains.xls | sed -e's/"//g' | while read l; do d=`echo "$l" | awk  '{print $2}'`; lynx "$d"; done

这篇关于如何使用Shell Script从Linux的Excel工作表中读取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆