字符串AWK搜索文件 [英] Awk Search file for string
本文介绍了字符串AWK搜索文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的形式实现,在一个字符串的文件搜索列的功能,效果很好。我想知道我怎么修改它来搜索所有列FR字符串?
I have implimented a function that searches a column in a file for a string and it works well. What I would like to know how do I modify it to search all the columns fr a string?
awk -v s=$1 -v c=$2 '$c ~ s { print $0 }' $3
感谢
推荐答案
如果所有列的意思是整个文件,那么:
If "all the columns" means "the entire file" then:
grep $string $file
这篇关于字符串AWK搜索文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文