linux - Grep 从 CSV 文件中获取特定列的最新值

标签 linux bash awk grep

"cola","colb","colc","cold","cole","colf"
"a","b","c","d","e","f"
"a1","b1","c1","d1","e1","f1"
"a2","b2","c2","d2","e2","f2"

假设这是 CSV 文件,我想要 grep"e"来自专栏"cole"并将其存储到 shell 变量中。然后使用 shell 变量作为 wget 的一部分命令。

我该怎么做?

最佳答案

set -f         # disable globbing
variable="$(awk 'NR==2 {print $5}' file)"
set +f

关于linux - Grep 从 CSV 文件中获取特定列的最新值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29780332/

相关文章:

linux - shell 脚本 : Not able to traverse files using $HOME or ~ in the path

linux - 如何正确使用手册页

linux - 从tar安装erlang导致错误,想知道如何指定文件夹

macos - 获取文件夹(或子文件/文件夹)的最后修改日期和时间

python - rm -rf 不通过 python fork execl 脚本删除目录

python - 如何获取分隔符出现的合并计数

c++ - 构建具有依赖项的 Linux 共享库时跳过编译时符号解析

linux - 根据特定文件的包含和排除列出 Linux 中的目录

linux - 使用 AWK -Bash 拆分和写入文件

awk - 使用grep或awk匹配文本