Created
February 3, 2024 13:12
-
-
Save GGontijo/ccd1bff3fdb09c3c217adfdaa7d0e176 to your computer and use it in GitHub Desktop.
linux find text pattern in texts and write something in front of them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
palavra="teste"; texto_adicional="deu certo"; for arquivo in teste*; do grep -q "$palavra" "$arquivo" && sed -i "/$palavra/ s/$/ $texto_adicional/" "$arquivo" && echo "Texto adicionado em $arquivo"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment