Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash delete a range of lines from a file

# Basic syntax using sed:
sed 'm,nd' input_file
# Where m is the start line number and n is the end line number inclusive

# Note, add -i to delete the lines in place. E.g.: 
sed -i 'm,nd' input_file # This changes the original input_file
Source by www.folkstalk.com #
 
PREVIOUS NEXT
Tagged: #bash #delete #range #lines #file
ADD COMMENT
Topic
Name
2+4 =