Zum Inhalt springen

Wie kann ich die Kommentare von den Konfiguration Dateien löschen


Empfohlene Beiträge

Geschrieben

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

Geschrieben

Quick und Dirty:

cat Konfigurationsdatei | grep -v "#" >> Konfigurationsdatei_neu

Geschrieben

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*

Geschrieben

Dann halt sauber:

cat Konfigurationsdatei | sed "^[^#]*?" >> Konfigurationsdatei_neu

Geschrieben

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

:D

Geschrieben
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.

Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde Dich hier an.

Jetzt anmelden

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...