“GREP Pertandingan Pertama” Kode Jawaban

bash grep hanya mengembalikan pertandingan pertama

# Basic syntax:
grep -m 1 "pattern" input_file.txt
# Where -m is the maximum number of matching lines to return, i.e. stop
#	reading the file after m matches
# Note, this is more efficient than piping to head because there you
#	always read the whole file even if you're only looking for m matches
Charles-Alexandre Roy

Pertandingan kedua Grep

#Combine grep and tail for grepping until second match and filtering 
#last with tail command
grep -m2 "two" in-file.txt | tail -n1
Armandres

GREP Pertandingan Pertama

Just combine grep with head command for filtering  only the first match as:
grep "match" | head -n 1   #Change 1 to not only match first but further matches
Armandres

Jawaban yang mirip dengan “GREP Pertandingan Pertama”

Pertanyaan yang mirip dengan “GREP Pertandingan Pertama”

Lebih banyak jawaban terkait untuk “GREP Pertandingan Pertama” di Shell/Bash

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya