]> Can any one tell me , how to remove some 5-6 lines
]> from a big text file using linux scripts
]
] ed vi sed tail head awk perl python grep. And I'm sure I missed
] another dozen.
I can think of a few not very nice ways that may work, but I'm sure there
are better ways.
Firstly, if you know the exact text of the lines you want to remove, then
try something like
cat filename | grep -v "first line" | grep -v "second line" | .... | grep -v
"last line" > newfilename
But that's horrible. Another way would be to use vi or emacs. If you know
which lines they will be all the time, then you can store the keystrokes you
requires in a file. I know using Emacs you can use ^Q and a character (like
^X) and it will put a ^X into the buffer instead of Email trying to
understand it. I'm sure this is possible in vim. So, you would have a file
like...
^N^N^N^N^N^K^K^K^K^K^K^X^S^X^C
and use a command line
emacs filename < keystrokesfile
Though that is also very very messy.
There are probably much better ways, and I'm sure someone will come up with
a few better ones for you.
Gary
**********************************************************************
This e-mail and any attachment contains information which is private
and confidential and is intended for the addressee only.
If you are not an addressee, you are not authorised to read, copy or
use the e-mail or any attachment.
If you have received this e-mail in error, please notify the sender
by return e-mail and then destroy it.
**********************************************************************
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!