Dear, I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf but I think it's too long, I have use $egrep -v '^#' file.conf but it containt so many blank lines. Is there any suggest what should I use ? Maybe like combining egrep with other script.. As simple as possible :) regards, -- Arie Reynaldi Zanahar reyman@reynaldi.com
On Thu, 2004-02-12 at 05:04, Arie Reynaldi Zanahar wrote:
Dear,
I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf
but I think it's too long, I have use $egrep -v '^#' file.conf Just add |egrep -v '^$' to the end : $egrep -v '^#' file.conf|egrep -v '^$'
but it containt so many blank lines. Is there any suggest what should I use ? Maybe like combining egrep with other script.. As simple as possible :)
regards,
-- Arie Reynaldi Zanahar reyman@reynaldi.com -- -- Raymond Leach
Network Support Specialist http://www.knowledgefactory.co.za "lynx -source http://www.rchq.co.za/raymondl.asc | gpg --import" Key fingerprint = 7209 A695 9EE0 E971 A9AD 00EE 8757 EE47 F06F FB28 --
Hi !
I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf
--> Another idea to remove these kind of comments, even if they do not start in the beginning of the line: sed -e 's/#.*//g'|grep -v '^$' HTH, Armin PS: By the way, why do you send all your messages 3-6 times to this list ? -- Am Hasenberg 26 office: Institut für Atmosphärenphysik D-18209 Bad Doberan Schloss-Straße 6 Tel. ++49-(0)38203/42137 D-18225 Kühlungsborn / GERMANY Email: schoech@iap-kborn.de Tel. +49-(0)38293-68-102 WWW: http://armins.cjb.net/ Fax. +49-(0)38293-68-50
I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf
--> Another idea to remove these kind of comments, even if they do not start in the beginning of the line:
sed -e 's/#.*//g'|grep -v '^$'
Oh, this seems to turn into a golf contest.-) Here, this works: grep -vP '^[ \t]*(#|$)' This should work too, but for some reason grep dumps core: grep -vP '^\s*(#|$)' -jk
Hi Arie,
I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf
but I think it's too long, I have use $egrep -v '^#' file.conf
send it through |grep -v ^$ ? kr=
Arie Reynaldi Zanahar wrote:
Dear,
I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf
but I think it's too long, I have use $egrep -v '^#' file.conf
but it containt so many blank lines. Is there any suggest what should I use ? Maybe like combining egrep with other script.. As simple as possible :)
I've had success with: egrep -v "^#|^$|^ #|^ *#" httpd.conf That strips out empty lines, comment lines that have a # in as the first character, coment lines that have a tab and # for the first two characters and comments that begin with multiple spaces followed by the # character. -- Until later, Geoffrey Registered Linux User #108567 Building secure systems inspite of Microsoft
Hello, I get the distinct impression that you are trying to grep non-commented, non-blank lines from a file. Is this correct? Regards, Richard Arie Reynaldi Zanahar said:
Dear,
I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf
but I think it's too long, I have use $egrep -v '^#' file.conf
but it containt so many blank lines. Is there any suggest what should I use ? Maybe like combining egrep with other script.. As simple as possible :)
regards,
-- Arie Reynaldi Zanahar reyman@reynaldi.com
-- Check the headers for your unsubscription address For additional commands, e-mail: suse-security-help@suse.com Security-related bug reports go to security@suse.de, not here
-- Het begint met margarine, en het eindigt met de teloorgang van alle menselijke waarden! -- De Volkskeuken, 28 oktober 2003
Dear,
I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf
but I think it's too long, I have use $egrep -v '^#' file.conf
but it containt so many blank lines. Is there any suggest what should I use ? Maybe like combining egrep with other script.. As simple as possible :)
regards,
-- Arie Reynaldi Zanahar reyman@reynaldi.com -- Ken Schneider unix user since 1989
On Wed, 2004-02-11 at 22:04, Arie Reynaldi Zanahar wrote: Can we please get this guy unsubscribed. linux user since 1994 SuSE user since 1998 (5.2)
participants (8)
-
Arie Reynaldi Zanahar
-
Armin Schoech
-
Geoffrey
-
Jaska Kivelä
-
Kenneth Schneider
-
kris carlier
-
Ray Leach
-
Richard