I am relatively new to shell scripting so apologies. I have found older questions which insert strings based on a string which appears in a line, but my lines are all of the same format.
I have a file in which I want to insert a string 'insert_text. below each line. I used vim to search for the line break and insert the string below in the following:
%s/\n/\r insert_text.\r/
The above works fine. However, I have 250 lines in my file and 12 specific lines for which I don't wish to insert the string below. I could search for each specific line and remove the string, but I would like to write a shell script that could automate it.
This is as close as I've got
#!/bin/bash
for line in {179, 170, 183, 104, 187, 172, 173, 171, 11, 7, 105, 3}
do
sed '\n/\r insert_text.\r/'
done
Obviously the above loop makes no sense, and the above code does the opposite of what I want, I want to insert the string into all the other lines.
Is there something similar to -v which would select all other lines in the for loop?