Answer the question
In order to leave comments, you need to log in
How to make sed delete from variable to end of line?
Hello Khabrovites!
I'm trying to auto-delete a piece of code using sed in a bash script.
I get the line number and write it to the global variable, but I can't delete from the global variable to the end of the line :
sed -i "${check},$d" report.html
It gives an error:
sed: -e expression #1, char 5: unexpected `,'
Tell me what I'm doing wrong?
Answer the question
In order to leave comments, you need to log in
If it is necessary to delete lines from the number in check to the end of the file, then:
sed -n "1,$((check-1))p"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question