I like to use "sed" command to delete two consecutive lines from a file. I can delete single line using following syntax where variable "index" holds the line number:
sed -i "${index}d" "$PWD$DEBUG_DIR$DEBUG_MENU"
Since I like to delete consecutive lines I did test this syntax which supposedly decrements / increments the variable but I am getting a bad substitution error.
Addendum I am not sure where to post this , but during troubleshooting of this issue I have discovered that this syntax does not work as expected
(( index++)) nor (( index-- ))
Using sed with "index" in single line deletion twice in a row / sequentially / works and resolves few issues.
#delete command line
sed -i "${index}d" "$PWD$DEBUG_DIR$DEBUG_MENU"
#delete description line
sed -i "${index}d" "$PWD$DEBUG_DIR$DEBUG_MENU"
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments