textutils

[bash] Fill placeholders in file in single pass

I have a skeleton text file with placeholder strings: blah blah blah blah $PLACEHOLDER_1$ blah $PLACEHOLDER_2$ and so on. Specific "form" of placeholders does not matter -- I may change them to whatever most comfortable for specific implementation. I have a bash script where I know values for placeholders, and I need to generate a ne...

Search and replace in Shell

I am writing a shell (bash) script and I'm trying to figure out an easy way to accomplish a simple task. I have some string in a variable. I don't know if this is relevant, but it can contain spaces, newlines, because actually this string is the content of a whole text file. I want to replace the last occurence of a certain substring w...