Posts

Showing posts from January 10, 2011

Delete all lines containing a pattern(vi and sed)

Image
sed : sed ( s tream ed itor ) is a Unix utility that parses text files and implements a programming language which can apply textual transformations to such files. It reads input files line by line (sequentially), applying the operation which has been specified via the command line (or a sed script ), and then outputs the line. It was developed from 1973 to 1974 as a Unix utility by Lee E. McMahon of Bell Labs, and is available today for most operating systems. How to remove Blank Lines or some line starting from particular pattern.    Here Suppose I want to remove the Blank Lines and Lines starting with #. Original File : [root@gateway ~]# cat a Default: # sleep_after_fork 0 #  TAG: max_filedesc #       The maximum number of open file descriptors. # #       WARNING: Changes of this value isn't respected by reconfigure         command. This value should be...