it’s me again. I am encountering another problem
First i need to match a certain pattern ,For example:
dfsdf
sdfd
sdfs
sdf
vcv
ssdff
sdfdsf
adssa
i need to match sdf , then i need to delete the following lines of a fixed number (eg.3DD)
can i use the vi command in bash programming? Or are there any way to acheive it ?thanks again
Again,
sedcomes to the rescue! To work on the lines following a match:This will remove the matching line, and the three following it. Just change the 3 to any number of lines you want to remove. Also, note that this will happen for every occurence of “sdf” in the input.
Just realized I might have misread the question. If you do not want to remove the matching line (“sdf” in this case), you can do like this: