<分区>
我有2
Linux
中的文件如下图
file1
test_1
test_3
test_5
test_6
file2
test_1,smoke_test
test_2,rain_test
test_3,sun_test
test_4,wind_test
我想比较这两个文件并删除file1
中的表存在于 file2
中那是comma(,)
之前的第一部分
需要的输出:
file3
test_5
test_6
我试过如下
grep -v -Ff <(cut -d',' -f1 file2) file1 >file3
我得到了我想要的。
现在当我写一个脚本时它抛出一个错误
new.sh: line 67: syntax error near unexpected token `('
Script
#!/bin/bash
grep -v -Ff <(cut -d',' -f1 file2) file1 >file3
我正在运行它:
sh -x script.sh