grep 搜索
grep 搜索
|
1. 快速上手
|

2. 常用
$gr
|

|

|

|

|

|
3. 快速应用:
抓取fasta序列:
测试文件:test.fa.txt
首先,把fasta文件规整成一行ID,一行序列格式。
|
3.1,获取所有的fasta ID
|

3.2,获取杠内ID
|

3.3,通过grep 多项匹配,获取前两个ID及其序列
|

4. 其他详细请看:
参数解释:https://www.runoob.com/linux/linux-comm-grep.html
复杂正则匹配:https://www.cnblogs.com/keithtt/p/6820540.html
Multi-words/strings grep
Shell can only 1000 args and if you exceeded it, you would end as error. For doing large number or words/strings match, we need to input words/strings in a file and grep it later. But the consuming time is raising largely after 1000.
| Number or words | time |
|---|---|
| 1000 | 0m1.954s |
| 2000 | 0m4.825s |
| 5000 | 0m26.232s |
Though, you can match thousands of words in a time, but you don’t have too or it doesn’t deserve it. In this time, a loop would much faster than single threads grep.









