Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

grep bestimmte Dateien übergeben

Empfohlene Antworten

Veröffentlicht

Hi,

wie kann ich grep dazu bringen nur bestimmte Dateitypen (z.B. nur .txt) in allen Unterverzeichnissen zu durchsuchen?

grep -ir meinregexp *
nimmt alle dateien
grep -ir meinregexp *.txt

funktioniert nicht

Falls das nicht direkt mit grep funktioniert ... kann man vielleicht auch das Ergebnis eines locate an grep übergeben?

Danke!

Gruß Scratch

und klappts mit locate? Wenn nicht benutz doch find:

find . -type f -name *.txt | grep 'deinregexp' 

habs zwar nicht getestet sollte aber funktionieren

einfacher:


find . -name *.txt -exec grep 'suchstring' {} \;

  • Autor

Erstmal Danke für die schnelle Antwort!

Leider klappt das nicht so ganz.

Ich möchte ja den Inhalt der Dateien durchsuchen und nicht den Dateinamen!

Egal ob ich find oder locate nehmen, er geht mit grep nur die Dateinamen durch.

Gruß Scratch

Richtig, ist mir gar nicht aufgefallen. In dem Aufruf, den t3q... gepostet hat, wird dem grep die Ausgabe vom find übergeben.

Mach es so, wie ich es geschrieben habe.

  • 6 Jahre später...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.