【问题标题】:Is there a way to delete rows from a csv file based on a list values from another file in windows?有没有办法根据 Windows 中另一个文件的列表值从 csv 文件中删除行?
【发布时间】:2022-01-07 08:54:43
【问题描述】:

我有两个文件:

候选人.csv:

id,value
aman,123
raju,1
suzy,5

黑名单.csv:

aman
suzy

生成的 csv 必须是:

raju,1

【问题讨论】:

    标签: windows csv delete-row


    【解决方案1】:

    我在 blacklist.csv 中添加了字段名称:

    id
    aman
    suzy
    

    然后你可以使用Miller 并运行

    mlr --csv join --np --ul -j id -f candidates.csv then unsparsify blacklist.csv >output.csv
    

    拥有

    id,value
    raju,1
    

    这是一个左join (--ul) 不发出配对记录 (--np)

    【讨论】:

      猜你喜欢
      • 2019-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-03
      • 1970-01-01
      相关资源
      最近更新 更多