Kev siv grep hauv Linux yog dab tsi?
Kev siv grep hauv Linux yog dab tsi?

Video: Kev siv grep hauv Linux yog dab tsi?

Video: Kev siv grep hauv Linux yog dab tsi?
Video: Google Colab - Searching a PDF! 2024, Kaum ib hlis
Anonim

Cov grep ua command yog siv txhawm rau tshawb nrhiav cov ntawv lossis tshawb cov ntaub ntawv muab rau cov kab uas muaj qhov sib tw rau cov hlua lossis cov lus. Los ntawm lub neej ntawd, grep ua qhia cov kab sib txuam. Siv grep txhawm rau tshawb nrhiav cov kab ntawv uas phim ib lossis ntau cov kab lus tsis tu ncua, thiab tso tawm tsuas yog cov kab sib txuam.

Tsis tas li ntawd, grep hais kom ua dab tsi hauv Linux nrog piv txwv?

Kawm Grep Command hauv Unix nrog Tswv yim Piv txwv : Grep hais kom ua hauv Unix / Linux yog daim ntawv luv luv ntawm 'kev tshawb nrhiav thoob ntiaj teb rau cov lus qhia tsis tu ncua'. Cov lus grep yog lub lim dej uas siv los tshawb nrhiav cov kab sib piv cov qauv uas tau teev tseg thiab luam cov kab sib txuam rau cov qauv tsim tawm.

Tsis tas li ntawd, grep command ua haujlwm li cas? Cov lus grep tshawb nrhiav ib lossis ntau cov ntaub ntawv nkag rau cov kab uas muaj qhov sib tw rau ib qho qauv. Los ntawm lub neej ntawd, grep ua luam cov kab sib txuam. Grep tshawb cov npe nkag FILEs (lossis cov qauv nkag yog tias tsis muaj cov ntaub ntawv muaj npe, lossis cov npe cov ntaub ntawv - tau muab) rau cov kab uas muaj qhov sib tw rau tus qauv muab.

Hauv qhov no, kuv yuav ua li cas grep cov ntaub ntawv hauv Linux?

Grep Suav kab yog ib txoj hlua / lo lus sib tw. Grep Los ntawm Cov ntaub ntawv thiab Display the Cov ntaub ntawv Lub npe.

Xaus.

Linux grep cov lus txib xaiv Kev piav qhia
-v Xaiv cov kab uas tsis sib xws
-n Sau kab xov tooj nrog cov kab tawm
-h Tshem tawm Unix cov ntaub ntawv npe ua ntej ntawm cov zis
-r Nrhiav cov npe recursivly ntawm Linux

Kuv yuav ua li cas grep ib lo lus tshwj xeeb hauv Linux?

Qhov yooj yim tshaj ntawm ob cov lus txib yog siv grep cov -w option. Qhov no yuav pom tsuas yog kab uas muaj koj lub hom phiaj lus ua tiav lus . Khiav qhov hais kom ua " grep ua -w hub" tiv thaiv koj lub hom phiaj cov ntaub ntawv thiab koj tsuas yog pom cov kab uas muaj cov lus "hub" ua tiav lus.

Pom zoo: