0

I want to append this line:

define(\RELAY_MAILER_ARGS', \TCP $h 587')dnl

In the 4th line of a file using bash, I need to do to put in script.

1
  • Is $h meant to be interpreted literally, or as the contents of a shell variable? Jan 16, 2020 at 12:49

1 Answer 1

0

Using sed:

 sed "4i define(\RELAY_MAILER_ARGS', \TCP $h 587')dnl"  {filename}

to repalce the content of fole:

sed -i "4i define(\RELAY_MAILER_ARGS', \TCP $h 587')dnl"  {filename}
2
  • Doesn't the i command insert above the addressed line? I would think you'd need a for "appending under a specific line number" Jan 16, 2020 at 12:49
  • @steeldriver you're right, however the question body says "In the 4th line".
    – Ravexina
    Jan 16, 2020 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .