How do I remove console output from an ed command?

284 views Asked by At

I'm using ed to insert contents in a file at a particular line number. This is the code section of my ed command.

ed servertest << END
$LineNumber      #15i
$Text            #this is text
.
w
q
END

The above code works fine and prints the text onto the file at the specified line number. However, I am getting an output on the console each time I run the code. For example:

$ bash code.sh
1456
1534

I think these numbers represent the number of characters in the file, servertest. I realise I do have 1456 characters in the un-edited file before running the code and 1534 characters after running the code. Is there a way I can not have these numbers shown on the console? I tried directing the output to dev/null but ed does not allow any characters after the last END command.

1

There are 1 answers

0
dave On BEST ANSWER

Use ed's silent option, ie:

ed -s servertest << END
...