i have a file that contains some text with comments i have to change the text ending with a special character to something else without changing any comment
example
------this is a comment1---
rose#
marigold#
------this is a comment2---
dog#
cat#
------pattern-------
------this is a comment3---
brazil
is awesome#
america#
what i needed
1.look for the "-----pattern----" start reading from there
2.skip the comments
3.store the string(important) in a variable till "#" is found.ADD "$" if the string start with vowel.
4.keep doing till the end of file
My final file should look like this
------this is a comment1---
rose#
marigold#
------this is a comment2---
dog#
cat#
------pattern-------
------this is a comment3---
brazil
is awesome#
$america#
this is what i have tried
awk '/----Pattern----/'{
while IFS="#" read -r LINE || [[ -n "$LINE" ]]; do
if echo "$LINE" |grep -q '^--'; then
continue
else if echo "$LINE" |grep -q '^a'; then
LINE="$""$LINE"
done
} file.txt
*this is not working .
i have less expierence with unix