Remove comments and blank lines from files
If you want to remove all the comment lines and the blank lines from a file to see the only active lines, just use sed as below:
sed '/^ *#/d; /^ *$/d' filename
You can also do it with alternate methods like that:
grep -v ' *#' filename | grep -v '^ *$'
but sed is better.
- 0 Comment
- Murat Demirten
- 18 Apr 2008, 13:44
-
You must be login first or sign-up for an account to post comments.
Maybe you should look at these also:
USERBOX
CATEGORIES
MOST READED TODAY
LAST ADDED
- Routing packets back from incoming interface
- Users with /bin/false shell to login on vsftpd
- Redirecting TCP ports with redir
- Assembly code of a C code
- Network interface status with mii-tool
- dropbear rsa key problem
- Displaying disk io statistics
- Disabling ssh password authentication
- Creating splitted rar archive files
- Creating self-extracting zip archives for both Linux and Windows
