Veröffentlicht 26. Januar 200520 j ich möchte die Kommentare von den Konfiguration Dateien löschen und dann die reine Konfiguration Information in eine Datei schreiben um nur die Konfiguration Information zu sehen. z.B. Squid Config # TAG: http_port # Usage: port # hostname:port # 1.2.3.4:port # # The socket addresses where Squid will listen for HTTP client # requests. You may specify multiple socket addresses. # There are three forms: port alone, hostname with port, and # IP address with port. If you specify a hostname or IP # address, then Squid binds the socket to that specific # address. This replaces the old 'tcp_incoming_address' # option. Most likely, you do not need to bind to a specific # address, so you can use the port number alone. # # The default port number is 3128. # # If you are running Squid in accelerator mode, then you # probably want to listen on port 80 also, or instead. # # The -a command line option will override the *first* port # number listed here. That option will NOT override an IP # address, however. # # You may specify multiple socket addresses on multiple lines. # # If you run Squid on a dual-homed machine with an internal # and an external interface then we recommend you to specify the # internal address:port in http_port. This way Squid will only be # visible on the internal address. # #Default: http_port 3128
26. Januar 200520 j Quick und Dirty: cat Konfigurationsdatei | grep -v "#" >> Konfigurationsdatei_neu
26. Januar 200520 j sehr dirty .... da es ja auch solche einträge geben könnte: http_blabla = 25 # number of http blablas allowed per minute also wenn dem eintrag noch ein comment folgt, was durchaus auch üblich ist... aber das wäre mir auf anhieb auch eingefallen, musst halt mal schaun ob es dir was bringt. wenn ich später mal zeit habe schau ich mal ob mir was anderes einfällt *g*
26. Januar 200520 j Dann halt sauber: cat Konfigurationsdatei | sed "^[^#]*?" >> Konfigurationsdatei_neu
26. Januar 200520 j Hallo, Quick und Dirty: cat Konfigurationsdatei | grep -v "#" >> Konfigurationsdatei_neu bei mir funktioniert das nicht: sed: -e expression #1, char 1: Unknown command: `^' Mindestens genauso sauber: cat Konfigurationsdatei | grep -Ev "^#" >> Konfigurationsdatei_neu
26. Januar 200520 j Hallo, ich will auch noch einen ... sed "/^[ ]*[ ]*[#]/d" Konfigdatei > Newkonfig [ ] = TAB cya alligator
26. Januar 200520 j grep -E .... Danke Schlaubi. *sed wegschmeiß* Hol ihn wieder raus....der von alligator ist nun wirklich perfekt, weil da auch am Anfang Blanks (Leerzeichen, sowie Tabs) stehen dürfen.
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.