A
A
Alexander Nazarov2022-03-22 20:45:50
linux
Alexander Nazarov, 2022-03-22 20:45:50

How to add text to a file after a certain line in Linux?

Tried like this, but writes after each line.

sed -i '/'после этой строки'/a "вставить это"'  /home/vasya/file.cnf;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2022-03-31
@mracoid

so you almost answered the question yourself. You need to replace 'after this line' with 'insert this after this line'.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question