Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
i want a command that must display the contents of a file???
cat=yes
but i want to avoid commented lines not to be displayed.anyway??
you know the big file like php.ini , i need to seacrch 1000 of lines. So , i want a command to display the contens of a file, which can output only non-commented lines.
That works on my system - what version of grep and what distro are you using? Your man page for grep will have info on whether you need to use an option to specify that your search is a regular expresision. On my system that would be:
Code:
grep -E -v '^#' <filename> | less
Also, do you have spaces at the start of the lines before the comment symbol?
well, prolly there is a space before the comment starts?
Would help if you posted some part of the file as is..
but seriously, you should be able to work on the nice lead by jschiwal.
All you have to do is find how to 'grep out' those lines. Since am too
lazy to look up the man pages for grep..
cat file | perl -pe 's/\s*#//'|less
or sed..
or you can use less'es 'not match' option and scroll line by line to entries that dont match a comment ..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.