unix:如何连接在grep中匹配的文件 [英] unix: how to concatenate files matched in grep

查看:91
本文介绍了unix:如何连接在grep中匹配的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想连接名称不包含_BASE_的文件。我认为这将会是... ...的一部分。

  ls | grep -v _BASE_ |猫> all.txt 

猫的部分就是我不明白的地方。任何人都可以给我一些想法吗?

p $ p> ls | grep -v _BASE_ | xargs猫> all.txt


I want to concatenate the files whose name does not include "_BASE_". I thought it would be somewhere along the lines of ...

ls | grep -v _BASE_ | cat > all.txt

the cat part is what I am not getting right. Can anybody give me some idea about this?

解决方案

Try this

ls | grep -v _BASE_ | xargs cat > all.txt

这篇关于unix:如何连接在grep中匹配的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆