sách gpt4 ai đã đi

Làm thế nào để xóa một chuỗi ký tự khỏi một tệp tin khi nó nằm trong một tệp tin khác?

In lại 作者:行者123 更新时间:2023-12-04 19:57:07 29 4
mua khóa gpt4 Nike

file1.txt

aaaa
bbbb
cccc
dddd
eeee

file2.txt

DDDD
cccc
aaaa

kết quả

bbbb
eeee

如果能不区分大小写就更好了!

Cảm ơn!

1 Câu trả lời

grep 可以匹配从文件中读取的模式,并打印出所有不匹配该模式的行。也可以不区分大小写地匹配,比如

grep -vi -f file2.txt file1.txt

手册页摘录:

SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]

-f FILE, --file=FILE
Obtain patterns from FILE, one per line. The empty file contains zero
patterns, and therefore matches nothing. (-f is specified by POSIX.)ns zero
patterns, and therefore matches nothing. (-f is specified by POSIX.)
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files. (-i is
specified by POSIX.)ions in both the PATTERN and the input files. (-i is
specified by POSIX.)
-v, --invert-match
Invert the sense of matching, to select non-matching lines. (-v is
specified by POSIX.)of matching, to select non-matching lines. (-v is
specified by POSIX.)

关于shell - (shell) 如何从一个文件中删除可以在另一个文件中找到的字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2380040/

29 4 0
Bài viết được đề xuất: python-3.x - Python 中的 exit(0) 和 exit(True) 之间有区别吗?
Bài viết được đề xuất: google-bigquery - Bigquery 中的两位数 ISO 周格式 (ww)
Bài viết được đề xuất: r - 在相关矩阵中包装轴标签
Bài viết được đề xuất: opengl - 在 WebGL 中重现 Cinder 故障
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com