如何访问与AWK在线txt文件? [英] How to access an online txt file with AWK?

查看:75
本文介绍了如何访问与AWK在线txt文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一个在线数据库,而不是在AWK本地文件。
例如:

I would like to use an online database instead of a local file in AWK. For instance:

awk 'END{print NR}' somelocalfile.txt

返回的行数的文件中。

returns number of lines inside the file.

现在我的问题是,我怎么能计算如这一个在线txt文件的行数的?我preFER单行命令。

Now my question is, how can I calculate number of lines in an online txt file like this one? I prefer one-liner command.

我能的wget 然后localY坐标申请就可以了 AWK 命令,但我觉得可以有更有效的方法

I can wget and then apply awk command localy on it, but I think there can be more efficient approach.

推荐答案

我会建议使用wget:

I would suggest to use wget:

wget -qO - http://path.com/tofile.txt | awk 'END{print NR}'

Q表示安静,所以你不会有从wget的任何端子输出。 -O是设置为与'-O - 到标准输出的输出。

q means quiet, so you won't have any terminal outputs from wget. -O is the output which is set to stdout with the '-O -'.

这篇关于如何访问与AWK在线txt文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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