I want to know how to quickly delete text with Bash. For example, I have a file named file.txt with a total of 500 lines.
I want to delete lines 80 to 146 - how do I do that?
What's is a terminal command that can do that?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityIf this is one time I would use vi or vim
vi {filename}
:86,146d
:wq
That last one saves and quits. Using sed:
sed '86,146d' {file}
Make a backup if unsure so you can revert.