Question

I am trying to build a Linux command to find a line in file and add more lines below that line. For example search for "Application" in a file, then get the line where this word is and add three more lines below it. I am currently using the absolute line number as in "sed -i '51icolumn1, column2, column3' test.txt" but if something change in this file I might be adding the text in a wrong place.

Was it helpful?

Solution

Would

sed -i '/Application/a column1, column2, column3\ncolumn1, column2, column3' test.txt

solve your issue?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top