bash的grep的结果到数组 [英] bash grep results into array
本文介绍了bash的grep的结果到数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在bash中我试图收集阵列的grep我的结果,每个细胞保持每一行。
我downloaing网址这一行
的wget -O指数-E $ CURRENTURL
块引用>,然后我希望到grep的索引文件的结果(其他网址)到数组每个单元的每一行,
什么应该是正确的语法?
阵列=(
grep的一些前pression指数
)
块引用>...
解决方案readarray GREPPED< ≤(grep的一些前pression指数)
在项目$ {GREPPED [@]}
做
#回声
回声$ {}项
DONE呵呵,并结合这些
-v
里grep像这样:的egrep -v'\\。(JPG | GIF | XML |拉链| ASP | PHP | PDF | RAR | CGI |?HTML)
In bash I'm trying to collect my grep results in array, each cell holding each line. I'm downloaing urls with this line
wget -O index -E $CurrentURL
and then i want to grep the 'index' file results (other urls) into array each line per cell, what should be the correct syntax?
Array=(
grep "some expression" index
)??
解决方案readarray GREPPED < <(grep "some expression" index) for item in "${GREPPED[@]}" do # echo echo "${item}" done
Oh, and combine those
-v
greps like so:egrep -v '\.(jpg|gif|xml|zip|asp|php|pdf|rar|cgi|html?)'
这篇关于bash的grep的结果到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文