sed: insert a string after every N lines
sed
Solution
This thread is another example of how to over complicate things. This should do it:
sed '0~30 s/$/string/g' < inputfile > outputfile
Every 30 lines "string" is inserted at the end of the line. If you want a new line with the word "string" just use "\n string".
Problem
I want to insert a string after every 30 lines in my large file. I'm using mini-sed, which doesn't support ~ (tilde) range operator. I'm looking for sed-only solution please.