linux - 如何在 bash shell 脚本中解析文件

标签 linux bash shell

<分区>

我想解析文件中的行: 喜欢:

0 0 0.00 0.20 0.00 5513 0.81 81

1 0 0.00 0.12 0.00 851 0.87 81

2 0 0.00 0.17 0.00 9485 0.76 79

3 0 0.00 0.13 0.00 3455 0.81 79

4 1 0.00 0.35 0.00 652 0.93 61

5 1 0.00 0.55 0.00 1730 0.97 61

6 1 0.00 0.40 0.00 389 0.97 55

7 1 0.00 0.33 0.00 1540 0.95 55

我想使用给定列中的值,如何提取这些值?

最佳答案

use the values from the given columns

假设给定的列是第二列,您可以将 awk

一起使用
awk '{print $2}' FILENAME

其中 $2 代表第二列。

关于linux - 如何在 bash shell 脚本中解析文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20231136/

相关文章:

c - 如何从 C 源代码创建可执行的 coff 文件

Linux Kernel 4.7 (Arch ARM64) 不在/sys/bus/pci/devices/*/中为 PCI BAR0 创建 "resource0"文件

linux - 字符串中的 Shell 脚本参数

linux - 指向头文件中 __u32 的指针

linux - 使用 sshpass 从本地 ubuntu 系统在远程服务器上执行脚本时,如何从远程 Ubuntu 服务器获取环境变量?

python - 编辑许多文本文件的脚本

linux - 使用我的 awk 脚本删除无用/空行

linux - 创建 bash 脚本以自动执行分析多个文件的任务

linux - 如何在 shell 中最后一次出现子字符串后剪切字符串?

linux - Java 1.8.0_77 中的 Linux 上缺少 jfxrt.jar