谁可以使用bash从文本文件中获取/复制特定单词? [英] Who to get/copy a specific word from a text file using bash?

查看:31
本文介绍了谁可以使用bash从文本文件中获取/复制特定单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我这样做时:

LINE=$(head -38 fine.txt | tail -1 | cut -f2)

我得到文件的第38行,即:

I get the 38th line of the file, which is:

Xres  = 1098

但是我只需要记录1098作为变量的值.

but I only need to record 1098 as value for a variable.

我正在训练中读取文本文件并记录值,并在稍后的脚本中将它们用作参数.

I am training to read a text file and record values and use them as parameters later in my script.

推荐答案

添加 |awk'{print $ 3}'进入管道.

这篇关于谁可以使用bash从文本文件中获取/复制特定单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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