I have a file (huge size) which cannot be opened in
vi but in
less mode and I want to delete the lines which I do not required. But I am unable to delete lines from file open in
Please suggest how can I delete lines in
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Probably the easiest thing would be to use
sed '/pattern/d' file to delete lines containing a certain pattern.
sed 'start_line_number,end_line_number d' file to delete a range of lines.
Both examples above will just print the file contents to STDOUT without modifying the contents. If you want to modify the actual file add
--in-place immediately after