Searching with grep · Mencari dengan grep
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Halaman ini memerlukan browser terbaru (dengan dukungan SharedArrayBuffer). Silakan perbarui Chrome, Edge, Firefox, atau Safari ke versi terbaru.
English
Finding text with grep
grepsearches for a word and prints only the lines that contain it:
- Out of a huge log, you instantly see just the lines that matter.
Bahasa Indonesia
Mencari teks dengan grep
grepmencari kata dan mencetak hanya baris yang memuatnya:
grep error log.txt
- Dari log yang sangat besar, Anda segera melihat hanya baris-baris yang relevan.
English
Useful options
-iignores case (soErrormatcheserror).-nshows the line number of each match.-vinverts — show lines that do not match.
Bahasa Indonesia
Opsi berguna
-imengabaikan huruf besar/kecil (sehinggaErrorcocok denganerror).-nmenampilkan nomor baris dari setiap kecocokan.-vmembalik — tampilkan baris yang tidak cocok.
grep -n ok log.txt
English
grep loves pipes
grepshines at the end of a pipe, filtering another command's output:
- "How many error lines?" — filter to errors, then count them. A everyday combo.
Bahasa Indonesia
grep menyukai pipes
grepbersinar di akhir pipe, menyaring output perintah lain:
cat log.txt | grep error | wc -l
- "Berapa banyak baris error?" — filter ke error, lalu hitung jumlahnya. Kombinasi sehari-hari.
English
Common mistakes
grep pattern filefinds matching lines; add-ito ignore case.- Quote a pattern that has spaces or special characters.
Bahasa Indonesia
Kesalahan umum
grep pattern filemenemukan baris yang cocok; tambahkan-iuntuk mengabaikan huruf besar/kecil.- Kutip pola yang memiliki spasi atau karakter khusus.
Explore · Jelajahi
grep inside a pipeline · grep dalam pipeline
grep filters a stream — feed it the output of another command. · grep memfilter stream — masukkan output dari perintah lain.
Show only the lines of log.txt that contain error, using grep error log.txt. · Tampilkan hanya baris dari log.txt yang berisi error, menggunakan grep error log.txt.
How many errors are there? Pipe grep into wc -l: grep error log.txt | wc -l. · Berapa banyak ralat yang terdapat? Salurkan grep ke dalam wc -l: grep error log.txt | wc -l.