I’ll have a go at this.
To delete 5 lines after a pattern (including the line with the pattern):
sed -e '/pattern/,+5d' file.txt
To delete 5 lines after a pattern (excluding the line with the pattern):
sed -e '/pattern/{n;N;N;N;N;d}' file.txt
More Related Contents:
- How to delete duplicate lines in a file without sorting it in Unix
- Why does my tool output overwrite itself and how do I fix it?
- Print lines in one file matching patterns in another file
- Some troubles with using sed and awk [closed]
- Enhancement of unix script [closed]
- sed edit file in place
- Replace a string in shell script using a variable
- How to select lines between two marker patterns which may occur multiple times with awk/sed
- Bash tool to get nth line from a file
- How to use variables in a command in sed?
- Is there a Unix utility to prepend timestamps to stdin?
- Delete specific line number(s) from a text file using sed?
- Remove all text before colon
- Extract specific columns from delimited file using Awk
- Explain awk command
- Get last field using awk substr
- Uppercasing First Letter of Words Using SED
- properly join two files based on 2 columns in common
- Remove line breaks in a FASTA file
- How to remove blank lines from a Unix file
- Split one file into multiple files based on delimiter
- Why doesn’t `\d` work in regular expressions in sed? [duplicate]
- What are the differences between Perl, Python, AWK and sed? [closed]
- delete a column with awk or sed
- How do you recursively unzip archives in a directory and its subdirectories from the Unix command-line?
- Extract lines between two patterns from a file [duplicate]
- Creating string of repeated characters in shell script [duplicate]
- Configure cron job to run every 15 minutes on Jenkins
- How to add text at the end of each line in unix
- How to print 5 consecutive lines after a pattern in file using awk [duplicate]