linux - 基于列连接两个 csv 文件

标签 linux bash shell csv

我有 2 个 csv 文件,如下

AllEmpployees.txt
EmpID,Name

QualifiedEmployeees.csv
Empid

现在我想查找合格员工的姓名

Empid,Name

我使用以下命令

   join -t , -1 1 -2 1 QualifiedEmployeees.csv AllEmployees.txt

这会导致零记录。我确信员工 ID 存在交集。

引用:https://superuser.com/questions/26834/how-to-join-two-csv-files

是否是因为合格员工文件只有一列并且没有分隔符?或者我做错了什么

最佳答案

试试这个:

join -t "," <(dos2unix <QualifiedEmployeees.csv) <(dos2unix <AllEmpployees.txt)

关于linux - 基于列连接两个 csv 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36733949/

相关文章:

ruby - 如何制作 Ruby 脚本以将 .mp3 文件移动到 iTunes 文件夹?

linux - 将 shell 脚本结果输出到文件,如终端屏幕

c - 如何在 C 中解析带引号分隔字段的 CSV?

c - 使用连续声明释放 C 中的内存

linux - 计数文件,隐藏文件除外

linux - 在 Bash shell if 语句中使用逻辑 OR

android - Linux下使用 "execve"运行android模拟器进程,但 "avd"路径错误?

bash - 从 Bash shell 将文本转换为字节?

linux - Azure Cloud shell 始终显示 "command not found"

git - 多个 git pull in 一个包含多个存储库的文件夹