How can I assign the match of my regular expression to a variable?

前端 未结 5 530
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-07 06:34

I have a text file with various entries in it. Each entry is ended with line containing all asterisks.

I\'d like to use shell commands to parse this file and assign each

5条回答
  •  孤城傲影
    2021-02-07 07:30

    Try putting double quotes around the command.

    #!/bin/bash
    for error in "`python example.py | sed -n '/.*/,/^\**$/p'`"
    do
        echo -e $error
        echo -e "\n"
    done
    

提交回复
热议问题