bash grep results into array

后端 未结 2 421
无人及你
无人及你 2021-01-11 13:57

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

2条回答
  •  执笔经年
    2021-01-11 14:08

     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?)'
    

提交回复
热议问题