You are not logged in.
Far too often - when checking out a .conf-file, there is a pletoria of comments and empty lines - in most cases, comments start with a '#'.
This li'l alias will remove all the verbosity:
alias stripcom='egrep -v "^[ \t]*#|^[ \t]*$"'
example of use:
stripcom /etc/vsftpd.conf
enjoy!
[edit]
had to allow for spaces/tabs _before_ the '#' ...
[/edit]
[more_edit]
guess I should do the same for end-of-line as well ... :-(
[/edit]
Last edited by perbh (2010-01-12 15:43:42)
Offline
................................ why?
Offline
*sigh* because - when people are asked to show their conf-files - you have to scroll down ad-infinitum to get to the juicy bits , those that really count. And all-to-often you look at the entries and miss out on the leading '#' - that's why! Using the above will give you only the 'valied' entries. But hey - you are free to ignore it!
Offline
i use it to see how many lines of code it took me to accomplish a given task.
egrep -v "^\s*(#|$)" /something.sh | wc -l
eeeek! that's even better!
Offline
sed -i "/^#/d;/^ *$/d"
also works
Offline
OK, it's a good idea, but there's no point on doing that.
/me wants you to detele this account... please delete it.
Offline
http://scienceblogs.com/insolence/facepalm.jpg
OK, it's a good idea, but there's no point on doing that.
You might want to read the entire thread - specifically, this bit:
*sigh* because - when people are asked to show their conf-files - you have to scroll down ad-infinitum to get to the juicy bits , those that really count. And all-to-often you look at the entries and miss out on the leading '#' - that's why! Using the above will give you only the 'valied' entries. But hey - you are free to ignore it!
The point is to cut down the amount of clutter in posts. It's an excellent idea.
Offline
sed -i "/^#/d;/^ *$/d"
Accomplishes something different, right? That actually removes them from the file, in place?
Offline
If you have xclip installed, couldn't you use:
egrep -v "^\s*(#|$)" /something.sh | xclip -selection c
to copy the contents of a config file, script, etc without comments directly to the clipboard, ready to be pasted into the forums?
Offline