sed save to same file in a while loop and multiple pipes

  Kiến thức lập trình

I have some files with the similar content like this:

    send_email(
        subject='subject',
        plain=plain,
        html=html,
        from_sender='from_name',
        sender_name='Some Name',
        attachment=True,
        files=[files],
    )
    break

Or this:

    send_email(
        subject='subject',
        plain=plain,
        html=html,
        from_sender='from_name',
        sender_name='Some Name',
    )
    break

This is my bash command:

while read -r file
do
    grep -A7 send_email "$file" | grep sender_name | sed -E 's/(sender_name=(.*))/1,n 
       running_cycle=running_cycle,/g' | sed -e 's/,,/,/g'
done < <(find . -type f -name '*.py' ! -name 'needs.py')

I am going to save to each file, and I tried this but failed:

... | sed -e 's/,,/,/g' -i "$file"

How can I update all files with this bash?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT