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 READ TODAY
- Enabling remote desktop on a VirtualBox Machine
- Redirecting tcp / udp ports with socat
- Syntax highlighting in less
- Passwordless sudo setup
- XFS Filesystem has duplicate UUID problem
- Disabling reverse dns lookups in ssh
- dropbear rsa key problem
- Routing packets back from incoming interface
- Multi-conditional search and replace (clearing a ftp trojan script example)
- Deleting A File By It's Inode Value
LAST ADDED
- Using iPhone internet sharing over bluetooth under Linux
- Using USB sound card with amarok
- Multi-conditional search and replace (clearing a ftp trojan script example)
- Disabling ipv6 functionality
- How to convert a mp3 file
- How to choose the fastest Debian mirror
- Disabling reverse dns lookups in ssh
- Rewriting destination ip address
- Deleting A File By It's Inode Value
- Learning which libraries are used for a binary
