Thursday 22 March 2018

लिनक्स ग्रेप - नो- द्विआधारी विकल्प


grep - यूनिक्स, लिनक्स कमांड। निर्देशिकाओं में रिक्तियां पीटीटीआरएन. स्पटॉप त्रुटि संदेश से मेल नहीं खाती, पैदल चलनेवाली फाइलों के बारे में कोई भी जानकारी या अपठनीय फाइलों के बारे में GNU grep के विपरीत पोर्टेबिलिटी नोट POSIX 2 के अनुरूप नहीं था, क्योंकि पारंपरिक जीआर में एक - q विकल्प और इसके - s विकल्प का अभाव था GNU grep s - q विकल्प की तरह व्यवहार किया गया शेल स्क्रिप्ट जो कि पारंपरिक Grep के लिए पोर्टेबल होने का इरादा था, दोनों - क और - एस से बचना चाहिए और आउटपुट को dev नल के बदले रीडायरेक्ट करना चाहिए। फ़ाइल को द्विआधारी के रूप में प्रतिलिपि बनाएं डिफ़ॉल्ट रूप से, MS-DOS और MS - विंडोज, जीआरपी फाइल प्रकार से फ़ाइल 32kb पढ़ने की सामग्री को देखकर अनुमान लगाती है अगर ग्रेप फ़ाइल का फैसला करता है तो वह एक पाठ फ़ाइल है, यह सीआर अक्षरों को मूल फाइल सामग्री से रेग्युलर एक्सप्रेशन बनाने और सही तरीके से काम करने के लिए स्ट्रिप्स करता है - यू इस अनुमानित कार्य को ओवरराइल करता है, जिससे सभी फाइलें पढ़ी जा सकती हैं और मेलिंग तंत्र के शब्दशः शब्द को पारित कर देती हैं यदि फ़ाइल प्रत्येक पंक्ति के अंत में सीआर एलएफ जोड़े के साथ एक पाठ फ़ाइल होती है, तो यह कुछ नियमित अभिव्यक्तियों को विफल करने के लिए प्रेरित करेगा यह opti एमएस-डॉस और एमएस-विंडों के अलावा अन्य प्लेटफॉर्म पर कोई प्रभाव नहीं है। यह यूनिक्स-स्टाइल बाइट ऑफ़सेट रिपोर्ट करें इस स्विच को ग्रिप बाइट ऑफ़सेट की रिपोर्ट करने का कारण बनता है जैसे कि फ़ाइल यूनिक्स-स्टाइल टेक्स्ट फाइल होती है, अर्थात सीआर अक्षरों से छीन लिया जाता है यूनिक्स मशीन पर grep चलाने के समान परिणाम यह विकल्प तब तक प्रभावी नहीं है जब तक - बी विकल्प का भी उपयोग न हो, इसका उपयोग एमएस-डॉस और एमएस-विंडोज के अलावा अन्य प्लेटफॉर्म्स पर कोई असर नहीं होता है। मानक त्रुटि के लिए grep का संस्करण संख्या प्रिंट करें यह संस्करण संख्या चाहिए सभी बग रिपोर्टों में शामिल होने के नीचे देखें। मिलान की भावना को मिलान न करना लाइनों का चयन करने के लिए। केवल उन पंक्तियों को चुनें जो मैचों में पूरे शब्दों का निर्माण करते हैं, यह परीक्षा यह है कि मिलान वाले सबरिंग को या तो लाइन की शुरुआत में होना चाहिए या एक गैर-वर्ड घटक चरित्र से पहले इसी प्रकार, यह या तो लाइन के अंत में होना चाहिए या उसके बाद गैर-शब्द घटक वर्ण वर्ड-कंटेंटेंट वर्ण अक्षर, अंक और अंडरस्कोर के बाद होना चाहिए। केवल उन मैचों का चयन करें जो बिल्कुल मेल खाते हैं पूरे लाइन। - i. Output के लिए पर्याय एक शून्य बाइट ASCII NUL चरित्र के बजाय चरित्र का नाम है, जो सामान्य रूप से एक फ़ाइल नाम के लिए उदाहरण के लिए, grep - lz प्रत्येक शून्य के बाइट के बाद एक सामान्य फ़ाइल के नाम पर प्रत्येक नई नाम के बजाय यह विकल्प बनाता है अनजान आउटपुट में, यहां तक ​​कि फाइल नामों की उपस्थिति में जैसे कि अनन्य पात्रों जैसे न्यूलाइन्स होते हैं, यह विकल्प कमांड के साथ इस्तेमाल किया जा सकता है जैसे कि प्रिंट - प्रिंट0, पेरल -0 सॉर्ट-जे और एक्सएर्ग -0, मनमाना फ़ाइल नामों को संसाधित करने के लिए, यहां तक ​​कि उन लोगों को भी जो कि नए अक्षरों वाले होते हैं। दी गई स्ट्रिंग को एक एकल फ़ाइल में खोजें। cat bin bash fun गूंज यह एक परीक्षा है, हमारी शेल स्क्रिप्ट को सफलतापूर्वक संदेश से बाहर निकलने के साथ निकालें 1. फ़ाइल grep exit से ऊपर। grep exit demofile. This मामले में दी गई स्ट्रिंग के लिए एकाधिक फ़ाइलों में जांच करने और cat bin bash fun गूंज यह एक परीक्षा है, सफलता संदेश से बाहर निकलने के साथ हमारी शैल स्क्रिप्ट को समाप्त करें। cat bin bash fun गूंज यह एक test1 है, हमारी फाइल स्क्रिप्ट को समाप्त करें, सफलतापूर्वक संदेश बाहर निकलें 0grep दोनों फ़ाइलों में बाहर निकलें और। बाहर निकलें 0 से बाहर निकलें 1. grep - i का उपयोग करने के लिए केस असंवेदनशील खोज, एटीआईआईटी में शामिल है। cat bin bash fun गूंज यह एक test1 है, सफलता संदेश के साथ हमारी शैल स्क्रिप्ट को समाप्त करें, 0 से बाहर निकलें 0 के साथ EXIT। grep exit exit 0. grep - i exit परीक्षा। सफलता संदेश के साथ हमारी शेल स्क्रिप्ट को समाप्त करें, 0 से बाहर निकालें 0 से दो लाइनें- I विकल्प के साथ - i विकल्प के रूप में, इसके मामले में असंवेदनशील। लिनक्स और यूनिक्स grep command. grep जो वैश्विक नियमित एक्सप्रेशन प्रिंट के लिए खड़ा है, लाइन द्वारा पाठ लाइन को प्रोसेस करता है और किसी भी लाइन को प्रिंट करता है जो एक निर्दिष्ट pattern. grep वाक्यविन्यास से मेल खाता है। Grep एक फ़ाइल, एकाधिक फ़ाइलों, या इनपुट की एक स्ट्रीम में पाठ के खिलाफ एक नियमित अभिव्यक्ति से मिलान करने के लिए एक शक्तिशाली टूल है यह पाठ के PATTERN को खोजता है जिसे आप कमांड लाइन पर निर्दिष्ट करते हैं, और आउटपुट आपके लिए परिणाम. उदाहरण उपयोग करें। चलो कहना है कि अपनी मशीन पर HTML फाइलों में वाक्यांशों को शीघ्रता से ढूंढना चाहते हैं चलो एक फाइल को खोजकर शुरू करते हैं, यहां पर हमारे PATTERN हमारे उत्पाद हैं और हमारी FILE. A एकल पंक्ति मिली हमारे पैटर्न वाला, और grep टर्मिनल पर पूरी मिलान लाइन को आउटपुट करता है लाइन हमारे टर्मिनल चौड़ाई से अधिक लंबा है, इसलिए पाठ को निम्न पंक्तियों के आसपास लपेटता है, लेकिन यह आउटपुट हमारी फाइल में एक ही रेखा से मेल खाती है। नोट: PATTERN को y grep एक नियमित अभिव्यक्ति के रूप में ऊपर दिए गए उदाहरण में, हम सभी अक्षरों और जगहों का इस्तेमाल करते हैं, ये वाक्यों को नियमित अभिव्यक्तियों में समझा जाता है, इसलिए केवल सटीक वाक्यांश मिलान किया जाएगा अन्य वर्णों के विशेष अर्थ हैं, हालांकि कुछ विराम चिह्न, उदाहरण के लिए अधिक जानकारी, हमारे नियमित अभिव्यक्ति त्वरित संदर्भ देखें। रंग में grep आउटपुट देखें। यदि हम --color विकल्प का उपयोग करते हैं, तो हमारे सफल मैचों को हमारे लिए हाइलाइट किया जाएगा। सफल मिलानों की लाइन संख्या देखें.यदि हम जानते हैं कि यह अधिक उपयोगी होगा हमारी लाइन में मिलान लाइन दिखाई देती है यदि हम - n विकल्प निर्दिष्ट करते हैं, तो grep लाइन संख्या के साथ प्रत्येक मिलान लाइन को प्रीफिक्स करेगा। हमारी मेलिंग लाइन 18 से उपसर्ग है, जो हमें बताती है कि यह हमारी फ़ाइल में पंक्ति 18 से मेल खाती है.प्रकार केस-असंवेदनशील grep खोजों। यदि हमारे उत्पाद वाक्य की शुरुआत में प्रकट होते हैं, या सभी अपरकेस में प्रकट होते हैं, तो हम - i विकल्प को केस-असंवेदनशील मिलान करने के लिए निर्दिष्ट कर सकते हैं। - i विकल्प का उपयोग करते हुए, grep लाइन 23 पर एक मैच पाता है एक वाइल्डकार्ड का उपयोग करते हुए कई फाइलों को खोजना.यदि हमारे पास खोज करने के लिए एकाधिक फ़ाइलें हैं, तो हम उन सभी को हमारे FILE नाम में एक वाइल्डकार्ड का उपयोग करके खोज सकते हैं इसके बजाय हम एक तारांकन और विस्तार का उपयोग कर सकते हैं जब कमांड निष्पादित हो जाती है, तो शेल तारांकन को उस किसी भी फ़ाइल के नाम पर विस्तारित करें जो वर्तमान निर्देशिका में पाता है जो समाप्त होता है। नोटिस कि प्रत्येक पंक्ति विशिष्ट फ़ाइल से शुरू होती है, जहां यह मैच होता है। ठीक से उप-निर्देशिकाओं को खोजते हैं। हम अपनी खोज को उप-डायरेक्टरीज़ और उन फ़ाइलों में उपयोग कर सकते हैं जिनमें वे शामिल हैं - r विकल्प है, जो grep को अपनी खोज को पुनरावृत्त करने के लिए कहता है आइए हम अपने FILE नाम को सिर्फ एक तारांकन करने के लिए बदल दें, ताकि यह किसी भी फाइल या निर्देशिका नाम से मेल करे, न कि सिर्फ HTML फ़ाइलें। यह हमें तीन अतिरिक्त मैचों देता है नोटिस डायरेक्टरी नाम किसी भी मिलान वाली फाइलों के लिए शामिल है जो वर्तमान निर्देशिका में नहीं हैं। अधिक शक्तिशाली खोजों को करने के लिए नियमित अभिव्यक्ति का उपयोग करना। grep की वास्तविक शक्ति यह है कि नियमित एक्सप्रेस से मिलान करने के लिए इसका उपयोग किया जा सकता है आयन यह है कि grep में फिर से रेगुलर एक्सप्रेशंस के लिए PATTERN स्ट्रिंग में विशेष वर्ण का इस्तेमाल स्ट्रिंग की एक विस्तृत सरणी से मेल करने के लिए है, यह एक साधारण उदाहरण को देखते हैं। चलो कहना है कि आप हमारे उत्पादों के समान एक वाक्यांश की हर घटना को ढूंढना चाहते हैं आपकी HTML फ़ाइलों में, लेकिन वाक्यांश हमेशा हमारे साथ शुरू करना चाहिए और उत्पादों के साथ समाप्त होना चाहिए हम अपने उत्पादों के बजाय इस PATTERN को निर्दिष्ट कर सकते हैं। नियमित अभिव्यक्तियों में, अवधि को एकल-वर्ण वाली वाइल्डकार्ड के रूप में समझा जाता है इसका मतलब है कि इस जगह पर दिखाई देने वाला कोई भी अक्षर मैच का अर्थ है, पूर्ववर्ती चरित्र, शून्य या अधिक बार प्रदर्शित होने वाला, मैच होगा तो संयोजन किसी भी संख्या के साथ किसी भी मेल से मेल खाएगा उदाहरण के लिए, हमारे आश्चर्यजनक उत्पाद, हमारा, सबसे अच्छा उत्पाद, और यहां तक ​​कि हमारे उत्पादों का भी मिलान होगा और क्योंकि हम - i विकल्प को निर्दिष्ट करना, हमारे उत्पाद और OuRpRoDuCtS भी मैच करेंगे, इस रेगुलर एक्सप्रेशन के साथ कमांड चलाने के लिए, और देखें कि हम कौन से अतिरिक्त मैचों को प्राप्त कर सकते हैं। यहां, हमें वाक्यांश से भी एक मैच मिला है हमारे अच्छे उत्पाद हैं। जीआरपी एक शक्तिशाली उपकरण है जो आपको पाठ फ़ाइलों के साथ काम करने में मदद कर सकता है, और जब आप नियमित अभिव्यक्तियों का उपयोग कर सहज हो जाते हैं तो यह और भी अधिक शक्तिशाली हो जाता है। तकनीकी विवरण ..gp नामित इनपुट FILE या मानक इनपुट की खोज करता है अगर कोई भी फाइल नहीं है नाम दिया गया है, या यदि एक एकल डैश - दिए गए PATTERN को मैच युक्त लाइनों के लिए फ़ाइल नाम के रूप में दिया जाता है, डिफ़ॉल्ट रूप से grep प्रिंटिंग लाइनों को प्रिंट करता है। इसके अलावा, तीन प्रकार के प्रोग्राम्स egrep fgrep और rgrep उपलब्ध हैं। enrep समान है grep - E चल रहा है इस मोड में, grep आपके पटरैन स्ट्रिंग का विस्तार करता है एक विस्तारित नियमित अभिव्यक्ति के रूप में आजकल ERE, बुनियादी नियमित अभिव्यक्ति से परे बहुत दूर का विस्तार नहीं करता है, लेकिन वे अब भी बहुत उपयोगी हो सकते हैं विस्तारित नियमित अभिव्यक्तियों के बारे में अधिक जानकारी के लिए मूल बनाम देखें विस्तारित रेगुलर एक्सप्रेशन below. fgrep वही है जो grep - F चल रहा है इस मोड में, grep आपके स्ट्रिंग का एक निश्चित स्ट्रिंग के रूप में मूल्यांकन करता है जो आपकी स्ट्रिंग में प्रत्येक अक्षर का शाब्दिक व्यवहार होता है उदाहरण के लिए, यदि आपकी स्ट्रिन जी में एक तारांकन होता है, grep इसे वाइल्डकार्ड के रूप में व्याख्या करने के बजाय इसे वास्तविक एस्टरिस्क से मेल करने की कोशिश करेगा यदि आपकी स्ट्रिंग में एकाधिक लाइनें हैं, अगर इसमें नई लाइनें हैं, तो प्रत्येक पंक्ति को एक निश्चित स्ट्रिंग माना जाएगा, और उनमें से कोई एक मैच ट्रिगर कर सकता है.rgrep चल रहा है grep - r चलने के समान है, इस पद्धति में, grep उसकी खोज को लगातार पुनरागमन करेगा यदि उसे एक निर्देशिका में सामना करना पड़ता है, तो वह उस निर्देशिका में घुस जाएगा और प्रतीकात्मक लिंक खोज जारी रखेगा यदि आप उन निर्देशिकाओं को खोजना चाहते हैं जो प्रतीकात्मक रूप से जुड़े हुए हैं, आपको इसके बजाय - R विकल्प का उपयोग करना चाहिए। पुराने ऑपरेटिंग सिस्टम में, उदा। एफजीआरएआर और आरजीआरआर अपने स्वयं के एक्सटेक्एबल के साथ अलग-अलग कार्यक्रम थे आधुनिक सिस्टम में, इन विशेष कमांड के नाम केवल उपयुक्त झंडे को सक्षम करने के लिए शॉर्टकट हैं, वे कार्यात्मक समकक्ष हैं। सामान्य विकल्प । कमांड लाइन विकल्पों का सारांश संक्षेप में एक सहायता संदेश मुद्रित करें, और बाहर निकलें। यदि संभव हो तो, डिफ़ॉल्ट पढ़ने प्रणाली कॉल के बजाय इनपुट पढ़ने के लिए mmap सिस्टम कॉल का उपयोग करें कुछ परिस्थितियों में, --ममप की पैदावार बेहतर प्रदर्शन हालांकि, --मैप कोर डंपों के साथ अपरिभाषित व्यवहार का कारण बन सकता है यदि grep ऑपरेटिंग हो रही है, या यदि कोई IO त्रुटि तब होती है। फ़ाइल को बाइनरी के रूप में प्रयोग करें डिफ़ॉल्ट रूप से, एमएस - डीओएस और एमएस-विन्डोज़, जीआरपी फ़ाइल प्रकार से पहली 32 केबी पढ़ने की सामग्री को देखकर फ़ाइल प्रकार का अनुमान लगाती है अगर ग्रेप फ़ाइल का निर्णय लेता है तो वह एक पाठ फ़ाइल है, यह सीआर अक्षरों को मूल फ़ाइल सामग्री से रेग्युलर एक्सप्रेशन बनाने के लिए तैयार करता है और सही ढंग से काम करें- U निर्दिष्ट करने वाली इस प्रक्रिया को, सभी फाइलों को पढ़ने और पारित करने के लिए मेलिंग तंत्र शब्दशः शब्द को पारित करते हैं यदि फ़ाइल प्रत्येक पंक्ति के अंत में सीआर एलएफ जोड़े के साथ एक पाठ फ़ाइल है, तो यह कुछ नियमित अभिव्यक्तियों को विफल करने के लिए कारण होगा एमएस-डीओएस और एमएस-विंडोज के अलावा अन्य प्लेटफार्मों पर विकल्प का कोई प्रभाव नहीं है। इनपुट को लाइनों के सेट के रूप में प्रयोग करें, प्रत्येक को शून्य बाइट द्वारा एस्केआईआईएल NUL वर्ण के बजाय एक नई लाइन के बजाय - Z या --null विकल्प के रूप में समाप्त किया जाता है, यह विकल्प को सॉर्ट जैसे कमानों के साथ प्रयोग किया जा सकता है - जमानी फ़ाइल नामों को संसाधित करने के लिए। नियमित अभिव्यक्ति। एक नियमित अभिव्यक्ति एक पैटर्न है जो स्ट्रिंग्स के एक सेट का वर्णन करता है। रेग्युलर एक्सप्रेशंस को रेग्युलेटिक एक्सप्रेशंस के लिए समान रूप से निर्मित किया जाता है, छोटे प्रोजेक्ट के साथ गठजोड़ करने के लिए विभिन्न ऑपरेटरों का इस्तेमाल करते हैं। grep नियमित अभिव्यक्ति वाक्य रचना के तीन अलग-अलग संस्करणों को समझता है मूल बीआरई, विस्तारित ईआरई और पीआरएल जीएनयू ग्रेप में बुनियादी और विस्तारित वाक्यविन्यास के बीच उपलब्ध कार्यक्षमता में कोई अंतर नहीं है अन्य कार्यान्वयन में, बुनियादी नियमित अभिव्यक्ति कम शक्तिशाली हैं निम्न विवरण नियमित रेगुलर एक्सप्रेशंस के लिए विस्तारित नियमित अभिव्यक्ति के अंतर पर लागू होते हैं, बाद में पर्ल नियमित अभिव्यक्ति अतिरिक्त कार्यप्रणाली देती हैं। मौलिक बिल्डिंग ब्लॉक्स नियमित अभिव्यक्तियां हैं जो एक अक्षर से मेल खाते हैं, अधिकांश अक्षर, सभी अक्षरों और अंकों सहित, नियमित अभिव्यक्तियां होती हैं जो स्वयं को मेल खाते हैं विशेष अर्थ के साथ किसी भी मेटा-वर्ण को बैकस्लैश के साथ पूर्व में उद्धृत किया जा सकता है व्याप्ति अवधि किसी भी एक अक्षर से मेल खाता है। चरित्र वर्ग और ब्रैकेट एक्सप्रेशन। एक ब्रैकेट अभिव्यक्ति द्वारा वर्णित वर्णों की एक सूची है और उस सूची में किसी भी एक अक्षर से मेल खाता है यदि सूची का पहला अक्षर कैरेट है तो वह उस सूची से किसी भी वर्ण से मेल नहीं खाता उदाहरण के लिए, नियमित अभिव्यक्ति 0123456789 किसी एकल अंक से मेल खाता है.एक ब्रैकेट अभिव्यक्ति के साथ, एक श्रेणी अभिव्यक्ति में दो अक्षरों को एक हाइफ़न से अलग किया जाता है यह किसी एकल वर्ण से मेल खाता है, जो दो वर्णों के बीच समावेशी है, जो लोकेल के कोलेटिंग अनुक्रम और वर्ण का उपयोग करता है उदाहरण के लिए, डिफ़ॉल्ट सी लोकेल में, विज्ञापन एबीसीडी के बराबर होता है, कई ऑक्सीजनों में क्रमबद्ध वर्ण क्रमबद्ध होते हैं, और इन लोकेल विज्ञापन में आम तौर पर एबीसीडी के बराबर नहीं होता है, यह एक बीबीसीसीडीडी के बराबर हो सकता है उदाहरण के लिए ब्रैकेट एक्सप्रेशंस के पारंपरिक व्याख्या प्राप्त करने के लिए , आप LCALL परिवेश चर को मान सी के लिए सी लोकेल का उपयोग कर सकते हैं। अंत में, वर्णों के कुछ नामित कक्षाएं फिर से ब्रैकेट एक्सप्रेशंस में पूर्वनिर्धारित किया गया है, जैसा कि उनके नाम स्वयं व्याख्यात्मक हैं, और वे अल्नम अल्फा cntrl अंक ग्राफ़ कम प्रिंट पंक्चर स्पेस ऊपरी और एक्सडीआईजीट हैं उदाहरण के लिए, अल्नम का मतलब है कि वर्तमान लोकेल में संख्याओं और अक्षरों का वर्ण वर्ग सी लोकेल और एएससीआईआई वर्ण सेट एन्कोडिंग, यह 0- 9 ए-ज़ा - ज के समान है, यह ध्यान रखें कि इन वर्ग के नामों में ब्रैकेट प्रतीकात्मक नामों का हिस्सा हैं, और कोष्ठक अभिव्यक्ति को विभाजित करने वाले कोष्ठकों के अतिरिक्त शामिल होना चाहिए। अधिकांश मेटा-वर्ण खो देते हैं ब्रैकेट एक्सप्रेशंस में उनका विशेष अर्थ एक शाब्दिक जगह को शामिल करने के लिए इसे पहली सूची में शामिल करना इसी प्रकार, एक शाब्दिक स्थान को कहीं भी शामिल करना है, लेकिन अंत में पहले, एक शाब्दिक शामिल करने के लिए - इसे आखिरकार रखें। कैरेट और डॉलर का चिह्न मेता-वर्ण हैं जो क्रमशः एक स्ट्रिंग की शुरुआत और समाप्ति पर रिक्त स्ट्रिंग से मेल खाती हैं। बैकस्लैश कैरेक्टर और स्पेशल एक्सप्रेशंस। प्रतीक और क्रमशः रिक्त स्ट्रिंग से एक शब्द की शुरुआत और समाप्ति से मेल खाती हैं ख एक शब्द के किनारे पर खाली स्ट्रिंग से मेल खाता है, और बी खाली स्ट्रिंग से मेल खाता है, यह किसी शब्द के किनारे पर नहीं है प्रतीक W अलिंम के लिए एक पर्याय है और W एल्म के लिए एक पर्याय है। एक नियमित अभिव्यक्ति का अनुसरण किया जा सकता है कई पुनरावृत्ति ऑपरेटरों में से एक .12 लिनक्स के व्यावहारिक उदाहरण grep कमांड। क्या आपको कभी भी किसी विशेष स्ट्रिंग या फ़ाइल के पैटर्न की खोज करने के कार्य के साथ सामना किया गया है, फिर भी यह पता नहीं है कि अच्छी तरह से दिखना कहाँ शुरू हो रहा है, यहां पर grep बचाव .12 गेराज कमांड Examples. grep एक शक्तिशाली फ़ाइल पैटर्न खोजक है जो लिनक्स के हर वितरण से लैस आता है, अगर किसी कारण के लिए, यह आपके सिस्टम पर स्थापित नहीं है, तो आप आसानी से अपने पैकेज प्रबंधक के द्वारा इसे इंस्टॉल कर सकते हैं। डेबियन उबंटु और यम पर आरएचईएल सेन्टस फेडोरा पर। मैंने पाया है कि अपने पैरों को जीआरपी के साथ गीला करने का सबसे आसान तरीका सिर्फ सही गोता लगाने और कुछ वास्तविक दुनिया उदाहरणों का उपयोग करना है। खोज और फ़ाइलें खोजें। यह कहें कि आपने अभी स्थापित किया है अपने मैक पर नए उबंटू की एक ताजा कॉपी हाइ, और आप पायथन को एक शॉट स्क्रीटिंग देने जा रहे हैं आप ट्यूटोरियल की तलाश में वेब पर दस्त डाल रहे हैं, लेकिन आप देखते हैं कि अजगर उपयोग में दो अलग-अलग संस्करण हैं, और आपको नहीं पता है कि आपके सिस्टम पर कौन सी इंस्टॉल किया गया था उबंटु इंस्टॉलर, या अगर यह किसी भी मॉड्यूल को स्थापित किया है तो बस इस कमांड को चलाएं। नमूना आउटपुट. पहले, हमने डीपीकेजी एल चलाया जो आपकी सिस्टम पर स्थापित संकुल को सूचीबद्ध करता है दूसरा, हम आउटपुट को grep i अजगर के लिए पाइप करते हैं, जो साधारण राज्यों को grep और फिल्टर करते हैं बाहर और उसमें अजगर के साथ सब कुछ वापस लौटायें I विकल्प है कि अनदेखा-मामला है, क्योंकि grep केस-संवेदी है I विकल्प का उपयोग करने की अच्छी आदत है, बेशक जब तक आप अधिक विशिष्ट खोज को खारिज करने की कोशिश नहीं कर रहे हैं 2 खोज और फ़िल्टर फाइलें। Grep का उपयोग व्यक्तिगत फाइलों या एकाधिक फ़ाइलों के भीतर खोज और फ़िल्टर करने के लिए भी किया जा सकता है। इस परिदृश्य को ले लो.आपके अपाचे वेब सर्वर से कुछ परेशानी हो रही है और आप कई भयानक मंचों में से एक पर पहुंच गए हैं शुद्ध कुछ के लिए पूछ रहा है मदद करने वाले दयालु आत्मा ने आपको अपने आदि अपाचे 2 साइटों की सामग्री पोस्ट करने के लिए कहा है-डिफ़ॉल्ट-एसएसएल फ़ाइल उपलब्ध है, यह आपके लिए आसान है, यह आपकी मदद करने वाला व्यक्ति है, और हर कोई इसे पढ़ रहा है, अगर आप सभी को निकाल सकते हैं टिप्पणी की रेखाें ठीक है आप इसे सिर्फ चला सकते हैं। v विकल्प grep को इसके आउटपुट को पलटने के लिए कहता है, जिसका अर्थ है कि मिलान लाइनों को छपाई करने के बजाय, विपरीत और उन सभी लाइनों को प्रिंट करें जो अभिव्यक्ति से मेल नहीं खाते, इस मामले में, टिप्पणी की गई lines.3 सभी फाइलें ही खोजें। grep stdout से फ़िल्टर करने के लिए बहुत उपयोगी हो सकता है उदाहरण के लिए, हम कहते हैं कि आपके पास एक संपूर्ण फ़ोल्डर है जो विभिन्न फ़ॉर्फ़ों के एक समूह में संगीत फ़ाइलों से भरा हुआ है। कलाकार जे जेड, लेकिन आप नहीं चाहते हैं कि किसी भी रीमिक्स पटरियों में से कुछ जीआरपी पाइप के साथ एक खोज कमांड का प्रयोग करें, जो चाल की जाएगी। इस उदाहरण में, हम सभी फाइलों को प्रिंट करने के लिए खोज कर रहे हैं, इसे एक पाइपिंग के साथ grep i को सभी फ़ाइलों को फ़िल्टर करें और प्रिंट करें, जे जेड नाम से और फिर एक और grep vi के लिए पाइप जो फ़िल्टर करता है और सभी फाइलनामों को किसी भी स्थिति में रीमिक्स के साथ स्ट्रिंग के साथ प्रिंट नहीं करता है। खोज स्ट्रिंग से पहले या बाद में पंक्तियों की संख्या प्रदर्शित करें। अन्य विकल्प के ए और बी स्विच हैं, जो मिलान लाइन और नंबर या तो खोज स्ट्रिंग से पहले या बाद में आते हैं, जबकि मैन पेज अधिक विस्तृत स्पष्टीकरण देता है, मुझे ए और बी के पहले विकल्पों को याद रखना सबसे आसान लगता है। इससे पहले प्रिंट के आसपास लाइनों की संख्या प्रिंट की होती है। grep s c विकल्प है समान, लेकिन स्ट्रिंग के पहले या बाद में आने वाली लाइनों को मुद्रित करने के बजाय, यह किसी भी दिशा में लाइनों को प्रिंट करती है। गणना संख्याओं की संख्या। शब्द गणना के लिए grep स्ट्रिंग को पाइप करने के समान। wc प्रोग्राम grep's built-in विकल्प कर सकते हैं आप के लिए समान 7. स्ट्रिंग के द्वारा खोज फ़ाइलें। grep के लिए n विकल्प बहुत उपयोगी है जब कंपाइल त्रुटियों के दौरान फाइलों को डीबग करना यह दी गई खोज स्ट्रिंग की फ़ाइल में लाइन संख्या प्रदर्शित करता है। एक स्ट्रिंग खोजें सभी निर्देशिकाओं में लगातार। आप चाहेंगे सभी निर्देशिकाओं के साथ मौजूदा निर्देशिका में एक स्ट्रिंग की खोज करने के लिए, आप रैपरिकशील खोज करने के लिए r विकल्प को निर्दिष्ट कर सकते हैं। 9 पूरे पैटर्न के लिए खोजें। w विकल्प को grep खोजों को स्ट्रिंग में पूरे पैटर्न के लिए खोजें उदाहरण का उपयोग करते हुए। उद्धरण में पैटर्न युक्त रेखा प्रिंट करें। दूसरी तरफ, अगर आप कोशिश करते हैं। कुछ भी नहीं लौटाया जाएगा क्योंकि हम एक पैटर्न के लिए नहीं खोज रहे हैं, लेकिन एक संपूर्ण शब्द। 10 जीज़िप फाइलों में एक स्ट्रिंग खोजें। कुछ का उल्लेख है grep s डेरिवेटिव्स सबसे पहले zgrep है, जो zcat के समान है gzipped फाइलों के उपयोग के लिए, यह grep के समान विकल्प लेता है और उसी तरह इस्तेमाल किया जाता है .1.1 फाइलों में नियमित रूप से मिलान करें। egrep एक और व्युत्पन्न है जो खड़ा है विस्तारित ग्लोबल रेगुलर एक्सप्रेशन के लिए यह अतिरिक्त अभिव्यक्ति मेटा-वर्ण जैसे और। एग्रेप को स्रोत फाइलों और कोड के अन्य टुकड़ों को खोजना बहुत उपयोगी है, की आवश्यकता होनी चाहिए इसे ई ऑप्टिओ निर्दिष्ट करके नियमित grep से लागू किया जा सकता है n.12 एक फिक्स्ड पैटर्न स्ट्रिंग खोजें। fgrep एक फाइल या एक निश्चित पैटर्न स्ट्रिंग के लिए फाइलों की सूची को खोजती है यह उसी तरह की है जैसे fgrep का उपयोग करने के लिए grep FA सामान्य तरीका यह है कि पैटर्नों की एक फाइल को पारित करने के लिए. यह सिर्फ एक शुरुआत है grep के साथ इंगित करें लेकिन जैसा कि आप संभवत: देखने में सक्षम हैं, यह विभिन्न उद्देश्यों के लिए अमूल्य है। एक तरफ से हमने एक सरल आदेश की आज्ञाओं को लागू किया है, grep का इस्तेमाल शक्तिशाली क्रॉन जॉब्स लिखने के लिए किया जा सकता है, और शुरुआत के लिए मजबूत खोल स्क्रिप्ट। रचनात्मक, मैन पेज में विकल्पों के साथ प्रयोग और grep अभिव्यक्ति के साथ आओ जो आपके स्वयं के प्रयोजनों को पूरा करती हैं। 7 लिनक्स ग्रेप या, Grep और, Grep NOT ऑपरेटर उदाहरण। प्रश्न आप यूनिक्स में OR, AND और NOT ऑपरेटरों का उपयोग कैसे कर सकते हैं कुछ उदाहरणों के साथ grep कमांड। उत्तर में grep में, हमारे पास ऑर और ओ ऑपरेटर्स के बराबर विकल्प हैं, कोई ग्रेप और ओपीएटर नहीं है लेकिन, आप पैटर्न का उपयोग करके और अनुकरण कर सकते हैं नीचे दिए गए उदाहरणों में आपको समझने में मदद मिलेगी कि कैसे उपयोग करें और, और और नहीं लिनक्स grep कमांड में निम्नलिखित फ़ाइल है निम्नलिखित उदाहरणों में उपयोग किया जाता है। आप पहले से ही जानते थे कि grep इन grep कमांड उदाहरणों के आधार पर बहुत शक्तिशाली है.ग्रेप या ऑपरेटर। grep के लिए निम्नलिखित 4 तरीकों में से कोई एक प्रयोग करें या मैं grep या operator.1 Grep के लिए नीचे उल्लिखित विधि संख्या 3 को पसंद करता हूं। या प्रयोग कर रहे हैं। यदि आप किसी भी विकल्प के बिना grep कमांड का उपयोग करते हैं, तो आपको या स्थिति के लिए कई पैटर्न अलग करने के लिए उपयोग करना होगा। उदाहरण के लिए, पाइप के सामने बैक स्लैश के बिना फाइल से टेक या बिक्री का उपयोग करें, काम नहीं करें.2 ग्रेप या प्रयोग - E. grep - E विकल्प विस्तारित regexp के लिए है यदि आप - ई विकल्प के साथ grep कमांड का उपयोग करते हैं, तो आपको बस या स्थिति के लिए कई पैटर्न को अलग करने के लिए उपयोग करना होगा। उदाहरण के लिए, grep या तो टेक या फ़ाइल से बिक्री बस एकाधिक या पैटर्न को अलग करने के लिए उपयोग करें .3 ग्रेप या egrep. egrep का उपयोग करना grep - E के समान है, तो किसी भी विकल्प के बिना egrep का उपयोग करें और या स्थिति के लिए कई पैटर्न अलग करें। उदाहरण के लिए, या तो टेक या फ़ाइल से बिक्री बस मल्टी को अलग करने के लिए उपयोग करें ple OR patterns.4 grep या grep - e. e उपयोग करना grep - e विकल्प का उपयोग करना आप केवल एक पैरामीटर को पारित कर सकते हैं या कंडीशन के लिए कई पैटर्न का उपयोग करने के लिए एकल आदेश में एकाधिक - ई विकल्प का उपयोग करें। उदाहरण के लिए, grep या तो Tech या Sales से फाइल एकाधिक या पैटर्न के लिए grep के साथ कई-ई विकल्प का उपयोग करें .5 Grep और का उपयोग करके - E पैटर्न 1 पैटर्न 2। grep में कोई और ऑपरेटर नहीं है, लेकिन आप अनुकरण और grep - E विकल्प का उपयोग कर सकते हैं। निम्न उदाहरण उसी क्रम में उसमें देव और टेक दोनों शामिल होते हैं। निम्नलिखित उदाहरण किसी भी क्रम में प्रबंधक और बिक्री दोनों को शामिल करने वाली सभी पंक्तियों को दोहराएगा। नोट: grep में नियमित अभिव्यक्ति का उपयोग करना बहुत शक्तिशाली है यदि आप जानते हैं कि इसका उपयोग कैसे करना है प्रभावी रूप से grep और एकाधिक grep कमांड का उपयोग कर। आप अनुकरण और परिदृश्य के लिए पाइप द्वारा अलग किए गए एकाधिक grep कमांड का उपयोग भी कर सकते हैं। निम्नलिखित उदाहरण उन सभी लाइनों को दोहराना होगा जो प्रबंधक और बिक्री दोनों में एक ही पंक्ति में शामिल हैं। v। grep - v का उपयोग आप NOT कंडी के अनुकरण कर सकते हैं tions - v विकल्प इनवर्ल्ड मैच के लिए है, अर्थात् ये दिए गए पैटर्न को छोड़कर सभी लाइनों से मेल खाता है। उदाहरण के लिए, उन कीवर्ड को छोड़कर सभी लाइनों को प्रदर्शित करें जो कीवर्ड की बिक्री में शामिल हैं। आप अन्य ऑपरेटर के साथ कुछ शक्तिशाली संयोजन प्राप्त करने के लिए नहीं भी जोड़ सकते हैं। उदाहरण के लिए , निम्न में से कोई भी प्रबंधक या डेवलपर बॉट बिक्री 5kkkk 5, 2013, 11 35 बजे उपेक्षा करेगा। एचएनएनएक्स ने बहुत मदद की, लेकिन दो तरीके से grep और किसी भी तरीके से केवल तभी प्रदर्शित किया जा सकता है अगर वे लगातार लाइनों में हैं यानी पैटर्न 1 ब्ला ब्ला ब्ला पैटर्न 2 blan blan blan pattern3 आदि आदि आदि पैटर्न 1 blah blah blah पैटर्न 3 आदि आदि आदि पैटर्न 2 blan blan blan. i चाहता हूँ आउटपुट केवल पहली और दूसरी लाइनों जहां पैटर्न 1 और पैटर्न 2 एक दूसरे के लिए लगातार हैं। 14 अप्रैल, 2013 को, 1 9 बजे। अन्य कमांड के साथ मिलकर काम करता है, उदाहरण के लिए ps-A उदारेप-आई गनोम केडीए दोस्त दालचीनी यह जानना कि क्या आपके द्वारा उपयोग किया जाने वाला डेस्कटॉप वातावरण है, GNOME, KDE, MATE या Cinnamon. Hi kkkk grep - B 1 pattern2 file1 grep - एक 1 पैटर्न 1 यदि यह मेरे पास है तो यह चाहिए सही फिल्टर पहले पैटर्न 2 और इसके पूर्ववर्ती रेखा के साथ सभी लाइनों के बाद सभी पैटर्न 1 के लिए फ़िल्टर करने के लिए पाइप तो इस मामले में जो भी होता है pattern2 अन्यथा आप awk gawk पर सिर कर सकते हैं थोड़ा देर हो चुकी है लेकिन अभी भी सादर। माइक मई 14, 2013, 3 17 बजे.मैं du कमांड डू-डू डू से आउटपुट हूं और इस पैटर्न का इस्तेमाल कर रहा हूं gp-pg t du। केवल जीबी के साथ प्रविष्टियों को दिखाने के लिए मैं grep-PT t du का उपयोग कर सकता हूँ। टेराबाइट्स दिखाने के लिए मैं यह देखने की कोशिश कर रहा हूँ कि क्या मुझे मिल सकता है दोनों grep-PT टी जी टी du. No का उपयोग करते हुए। grep - EP टी टी जी टी du. का उपयोग करते हैं। उन लाइनों सहित आउटपुट का टन देता है, जो मिलान नहीं किया जाना चाहिए। एशुरैक्स 24 जून, 2013, 1 17 बजे। अद्वितीय पैटर्न कई फाइलें egrep pattern1 pattern2 file1 file2 sort - u. Gb के लिए टी आउटपुट में टीबी और जीबी निर्देशिकाओं का उपयोग करते हुए bash du - h का उपयोग करते हुए उदाहरण के लिए टीएसजी टी.आई. आई. आई. एस. zsh का उपयोग करते हुए, नियंत्रण - V दबाएं, और तब टीएयू डू-एच उदा। टी जी.एले 10 जुलाई, 2013, 10 48 बजे। जोन नेविल फ़रवरी 10, 2016, 11 12 बजे। यदि एक पैटर्न में रिक्त स्थान होता है, तो उस पैटर्न को एक ही उद्धरण चिह्नों के अंदर डबल कोट्स में होना चाहिए मेरे लिए काम नहीं करना चाहिए अन्य पैटर्न को दोहरे उद्धरण में रखा जाना चाहिए भले ही यह एक एकल शब्द है। grep - H - r - E उदाहरण example2 को dot2 sample2 के लिए example. tot - से 12 फ़रवरी 2016, 11 28 am. egrep प्रबंधक डेवलपर grep - v बिक्री। यह नोड का संयोजन है और न कि और मैं या I के प्रारंभिक सूची से बाहर होना चाहता हूँ का संयोजन कैसे करना है केवल उन लोगों का नाम जो जॉन है और जो प्रबंधकों जॉन्स नहीं हैं जो प्रबंधकों और लोगों के हैं अन्य नामों के साथ grepped list. grep में रहना चाहिए, जिसमें एक पैटर्न के लिए मैच होता है। यह मैनुअल GNU Grep के संस्करण 3 0 के लिए है। यह मैनुअल grep के लिए एक पैटर्न मिलान इंजन है। कॉपीराइट 1999-2002, 2005, 2008 -2017 फ्री सॉफ्टवेयर फाउंडेशन, इंक। इस दस्तावेज़ की प्रतिलिपि बनाने, वितरित करने और संशोधित करने के लिए जीएनयू फ्री डॉक्यूमेंटेशन लाइसेंस, संस्करण 1 3 या किसी भी बाद के संस्करण के तहत नि: फ्रंट-कवर ग्रंथ, और कोई बैक-कवर ग्रंथों के साथ लाइसेंस की एक प्रति जीएनयू फ्री डॉक्यूमेंटेशन लाइसेंस के अंतर्गत आने वाले अनुभाग में शामिल है। परिचय 1. जीआरपी में दिए गए पैटर्न सूची में मिलान युक्त लाइनों के लिए इनपुट फाइल खोजती है जब यह एक पंक्ति में एक मैच पाता है, तो यह मानक को मानक आउटपुट के रूप में प्रतिलिपि बनाता है, या जो भी उत्पादन करता है अन्य प्रकार की आउटपुट जिसे आपने विकल्प के साथ अनुरोध किया है। हालांकि grep को पाठ पर मिलान करने की उम्मीद है, इसमें उपलब्ध स्मृति के अलावा इनपुट लाइन की लंबाई पर कोई सीमा नहीं है, और यह एक पंक्ति के भीतर मनमाना वर्णों से मेल कर सकता है यदि इनपुट फ़ाइल का अंतिम बाइट एक नई लाइन नहीं है, ग्रिप्ल चुपचाप एक आपूर्ति करता है चूंकि न्यूलाइन पैटर्नों की सूची के लिए एक विभाजक भी है, इसलिए टेक्स्ट में नए अक्षरों से मिलान करने का कोई तरीका नहीं है। grep को शामिल करना। grep कमांड लाइन का सामान्य सारांश। शून्य या अधिक विकल्प पैटर्न केवल एक ऐसे इनपुट फ़िलन के रूप में नहीं देखे जा सकते हैं, जैसे कि ई-ई पैटर्न या - f फ़ाइल विकल्पों का उपयोग करके पहले से ही विकल्पों में निर्दिष्ट नहीं किया गया है शून्य या अधिक इनपुटफ़ाइलनाम हो सकते हैं। लघु और लंबे नाम, ग्रुप श्रेणी के द्वारा 1 .3 बुनियादी संरचना। मौलिक भवन ब्लॉक्स नियमित अभिव्यक्तियां हैं जो एक अक्षर से मेल खाते हैं, सभी अक्षरों और अंकों सहित अधिकतर वर्ण, नियमित अभिव्यक्तियां होती हैं जो किसी विशेष मेटा-वर्ण के साथ मेल खाती हैं जो पूर्ववर्ती होती है एक बैकस्लैश के साथ। एक नियमित अभिव्यक्ति का पालन कई पुनरावृत्ति ऑपरेटरों में से एक हो सकता है। अवधि किसी एकल वर्ण से मेल खाता है। पिछला आइटम वैकल्पिक है और सबसे अधिक बार मिलान होगा। पिछला आइटम शून्य या अधिक बार से मेल खाएगा। आइटम को एक या एक से अधिक बार मिलाया जाएगा। पिछला आइटम सटीक n गुणा से मेल खाएगा। पिछला आइटम n या अधिक बार से मेल खाता है। पिछला आइटम अधिकतर मी समय से मेल खाता है यह एक जीएनयू एक्सटेंशन है। पिछला आइटम कम से कम n बार, लेकिन मी बार से ज्यादा नहीं। रिक्त नियमित अभिव्यक्ति खाली स्ट्रिंग से मेल खाती है दो रेगुलर एक्सप्रेशन को जोड़ दिया जा सकता है जिसके परिणामस्वरूप रेगुलर एक्सप्रेशन किसी भी स्ट्रिंग से मेल खाता है दो substrings को दोहराया जाता है जो क्रमशः कंसेटेनेटेड भावों से मेल खाती हैं। दो नियमित अभिव्यक्तिएं इन्फिक्स ऑपरेटर द्वारा जुड़ी हो सकती हैं, परिणामस्वरूप नियमित अभिव्यक्ति किसी भी वैकल्पिक अभिव्यक्ति से मेल खाते वाली किसी भी स्ट्रिंग से मेल खाते हैं। पुनरावृत्ति एकता के ऊपर पूर्वता लेती है, जो बदले में वैकल्पिकता पर पूर्वता लेता है एक संपूर्ण अभिव्यक्ति हो सकती है इन प्राथमिकता नियमों को ओवरराइड करने के लिए कोष्ठकों में संलग्न किया जाता है और उप-अभिव्यक्ति का निर्माण होता है एक बेजोड़ मेल सिर्फ खुद .2 2 वर्ण वर्ग और ब्रैकेट एक्सप्रेशंस। एक ब्रैकेट एक्सप्रेशन वर्णों की एक सूची है और यह उस सूची में किसी एकल वर्ण से मेल खाता है, अगर उसका पहला अक्षर सूची कैरेट है, फिर यह किसी भी चरित्र से मेल नहीं खाता है उदाहरण के लिए, नियमित अभिव्यक्ति 0123456789 किसी एकल अंक से मेल खाती है.एक ब्रैकेट एक्सप्रेशन के साथ, एक रेंज एक्सप्रेशन में दो अक्षर हाइफ़न से अलग होते हैं यह किसी एक कैरेक्टर से मेल खाता है जो कि दो अक्षर के बीच, समावेशी डिफ़ॉल्ट सी लोकेल में, sorti एनजी अनुक्रम उदाहरण के लिए मूल वर्ण क्रम है, विज्ञापन एबीसीडी के बराबर है अन्य लोकेल में, छँटाई अनुक्रम निर्दिष्ट नहीं है, और विज्ञापन एबीसीडी या एबीसीसीडीडी के समतुल्य हो सकता है, या यह किसी भी वर्ण, या सेट का मिलान करने में विफल हो सकता है ब्रैकेट एक्सप्रेशन के पारंपरिक व्याख्या प्राप्त करने के लिए, आप LCALL परिवेश चर को मान सी में सेट करके सी लोकेल का उपयोग कर सकते हैं। अंत में, वर्णों के कुछ नामित वर्ग ब्रैकेट अभिव्यक्तियों में पूर्वनिर्धारित हैं, उनके अनुसार व्याख्या एलसीसीटीईपीईई लोकेल पर निर्भर करती है उदाहरण के लिए, एल्मम का अर्थ है वर्तमान लोकेल में संख्याओं और अक्षरों के चरित्र वर्ग। सी लोकल और एएससीआईआई वर्ण एन्कोडिंग में अल्फ़ान्यूमेरिक वर्ण अल्फा और अंक, यह 0- 9 ए-ज़ा-जे के समान है। सी लोकेल और एएससीआईआई वर्ण एन्कोडिंग में कम और ऊपरी वर्णमाला वर्ण, यह ए-ज़ा-जेड के समान है। ब्लैंक वर्ण स्थान और टैब। एएससीआईआई में नियंत्रण अक्षर, इन अक्षरों में अष्टक डेस 000 से 037, और 177 डीएल अन्य वर्ण सेटों में, ये बराबर अक्षर हैं, यदि कोई हो। 0 0 2 2 3 4 5 6 7 8 9.गैफिकल वर्ण एल्नम और पंच। सी लोकेल और एएससीआईआई में कम-केस अक्षरों चरित्र एन्कोडिंग, यह abcdefghijklmnopqrstu vwxy z. प्रेंट करने योग्य वर्ण अल्नाम, पंक्चर और स्पेस है। सी लोकेल और एएससीआईआई वर्ण एन्कोडिंग में अन्तर्निर्मन वर्ण, यह है - सी। लोकल में स्पेस वर्ण, यह टैब, न्यूलाइन, वर्टिकल टैब, फॉर्म है फ़ीड, कैरिएज़ रिटर्न, और स्पेस को अधिक से अधिक चर्चा के लिए उपयोग की जाने वाली न्यूलाइनों के बारे में जानें। सी लोकेल और एएससीआईआई वर्ण एन्कोडिंग में अपर-केस अक्षरों में, यह एबीसीडीईएफजीएचआईजेकेएलएमएनओपीक्यूआरटीयू वीडब्ल्यूएक्सवाई जेड। हेक्सैडेसिमल अंक 0 1 2 3 4 5 6 7 8 9 एबीसीडीईएफ एबीसीडी एफ नोट करें कि इन वर्ग के नामों में ब्रैकेट प्रतीकात्मक नामों का हिस्सा हैं, और ब्रैकेट अभिव्यक्ति को विभाजित करने वाले कोष्ठकों के अतिरिक्त शामिल होना आवश्यक है। यदि आप गलती से बाह्य कोष्ठक को छोड़ देते हैं, और कहें तो ऊपरी, जीएनयू की खोज करें grep एक नैदानिक ​​प्रिंट करता है और स्थिति 2 के साथ बाहर निकलता है, इस धारणा पर कि आप नाममात्र के बराबर नियमित अभिव्यक्ति एप्री को इस सुविधा को अक्षम करने के लिए POSIXLYCORRECT परिवेश चर सेट करने का इरादा नहीं करते हैं। अधिकांश मेटा-वर्ण ब्रैकेट एक्सप्रेशन में अपना विशेष अर्थ खो देते हैं। ब्रैकेट अभिव्यक्ति यदि यह पहली सूची आइटम नहीं है तो, यदि आप वर्ण को एक सूची आइटम बनाना चाहते हैं, तो आपको इसे पहले रखना चाहिए। खुला कॉलिंग प्रतीक का प्रतिनिधित्व करता है। निकट कॉलटिंग प्रतीक का प्रतिनिधित्व करता है। खुला समकक्ष वर्ग प्रस्तुत करता है। बंद समकक्ष वर्ग। खुले वर्ण वर्ग के प्रतीक का प्रतिनिधित्व करता है, और एक मान्य वर्ण वर्ग के नाम के अनुसार होना चाहिए। निकट वर्ण वर्ग के प्रतीक का प्रतिनिधित्व करता है। श्रेणी का प्रतिनिधित्व करता है यदि वह किसी सूची में या अंतिम श्रेणी के समापन बिंदु या किसी श्रेणी के नहीं है। वर्णों को सूची में नहीं दर्शाता है यदि आप वर्ण को एक सूची वस्तु बनाना चाहते हैं, तो इसे कहीं भी रखें लेकिन पहले .3 बैकस्लैश कैरेक्टर और स्पेशल एक्सप्रेशंस। चरित्र, जो और कुछ सामान्य वर्णों के बाद, एक विशेष अर्थ लेता है.एक शब्द के किनारे पर रिक्त स्ट्रिंग को पकड़ो। खाली स्ट्रिंग को एक शब्द के किनारे पर नहीं मिला। शब्द की शुरुआत में रिक्त स्ट्रिंग को पकड़ो। शब्द के अंत में खाली स्ट्रिंग। मैच शब्द घटक, यह एल्मम के लिए एक पर्याय है। मैच नॉन-शब्द घटक, यह अल्नम के लिए एक पर्याय है। मैच व्हाइटस्पेस, यह अंतरिक्ष के लिए एक पर्याय है। मैच नॉन-व्हाइस स्पेस, यह एक है स्थान के लिए पर्याय। उदाहरण के लिए, ब्रैट ब अलग शब्द चूहे से मेल खाता है, ब्रैट बी मैचों में पेकेट होता है, लेकिन रसीरा नहीं होता। 4.3 एंकरिंग। कैरेट और डॉलर का चिह्न मेटा-वर्ण होते हैं जो क्रमशः खाली स्ट्रिंग से शुरुआत और अंत में मेल खाते हैं a line They are termed anchors since they force the match to be anchored to beginning or end of a line, respectively.3 5 Back-references and Subexpressions. The back-reference n , where n is a single digit, matches the substring previously matched by the n th parenthesized subexpression of the regular expression For example, a 1 matches aa When used with alternation, if the group does not participate in the match then the back-reference makes the whole match fail For example, a b 1 will not match ba When multiple regular expressions are given with - e or from a file - f file , back-references are local to each expression.3 6 Basic vs Extended Regular Expressions. In basic regular expressions the meta-characters. Traditional egrep did not support the. GNU grep - E attempts to support traditional usage by assuming that. Here is an example command that invokes GNU grep. This lists all lines in the files menu h and main c that contain the string hello followed by the string world this is because matches zero or more characters within a line See Regular Expressions The - i option causes grep to ignore case, causing it to match the line Hello, world , which it would not otherwise match See Invoking for more details about how to invoke grep. Here are some common questions and answers about grep usage. How can I list just the names of matching files. lists the names of all C files in the current directory whose contents mention main. How do I search directories recursively. searches for hello in all files under the home gigi directory For more control over which files are searched, use find grep and xargs For example, the following command searches only C files. This differs from the command. which merely looks for hello in all files in the current directory whose names end in c The find command line above is more similar to the command. What if a pattern has a leading. searches for all lines matching --cut here-- Without - e grep would attempt to parse --cut here-- as a list of options. Suppose I want to search for a whole word, not a part of a word. searches only for instances of hello that are entire words it does not match Othello For more control, use and to match the start and end of words For example. searches only for words ending in hello , so it matches the word Othello. How do I output conte xt around the matching lines. prints two lines of context around each matching line. How do I force grep to print the name of the file. Alternatively, use - H which is a GNU extension. Why do people use strange regular expressions on ps output. If the pattern had been written without the square brackets, it would have matched not only the ps output line for cron but also the ps output line for grep Note that on some platforms, ps limits the output to the width of the screen grep does not have any limit on the length of a line except the available memory. Why does grep report Binary file matches. If grep listed all matching lines from a binary file, it would probably generate output that is not useful, and it might even muck up your display So GNU grep suppresses output from files that appear to be binary files To force GNU grep to output lines even from files that appear to be binary, use the - a or --binary-files text option To eliminate the Binary file matches messages, use the - I or --binary - files without-match option. Why doesn t grep - lv print non-matching file names. grep - lv lists the names of all files containing one or more lines that do not match To list the names of all files that contain no matching lines, use the - L or --files-without-match option. I can do OR with , but what about AND. finds all lines that contain both paul and franc, ois. Why does the empty pattern match every input line. The grep command searches for lines that contain strings that match a pattern Every line contains the empty string, so an empty pattern causes grep to find a match on each line It is not the only such pattern , , , and many other patterns cause grep to match every line. To match empty lines, use the pattern To match blank lines, use the pattern blank To match no lines at all, use the command grep - f dev null. How can I search in both standard input and in files. Use the special file name. How to express palindromes in a regular expression. It can be done by using back-references for exam ple, a palindrome of 4 characters can be written with a BRE. It matches the word radar or civic. Guglielmo Bondioni proposed a single RE that finds all palindromes up to 19 characters long using 9 subexpressions and 9 back-references. Note this is done by using GNU ERE extensions it might not be portable to other implementations of grep. Why is this back-reference failing. This gives no output, because the first alternate a 1 does not match, as there is no aa in the input, so the 1 in the second alternate has nothing to refer back to, meaning it will never match anything The second alternate in this example can only match if the first alternate has matched making the second one superfluous. How can I match across lines. Standard grep cannot do this, as it is fundamentally line-based Therefore, merely using the space character class does not match newlines in the way you might expect. With the GNU grep option - z --null-data , each input and output line is null-terminated see Other Options Thus, you can match newlines in the input, but typically if there is a match the entire input is output, so this usage is often combined with output-suppressing options like - q e g. If this does not suffice, you can transform the input before giving it to grep or turn to awk sed perl or many other utilities that are designed to operate across lines. What do grep fgrep and egrep stand for. The name grep comes from the way line editing was done on Unix For example, ed uses the following syntax to print a list of matching lines on the screen. fgrep stands for Fixed grep egrep stands for Extended grep.5 Reporting bugs. Bug reports can be found at the GNU bug report logs for grep If you find a bug not listed there, please email it to to create a new bug report.5 1 Known Bugs. Large repetition counts in the construct may cause grep to use lots of memory In addition, certain other obscure regular expressions require exponential time and space, and may cause grep to run out of memory. Back-references are very slow, and may require exponential time. GNU grep is licensed under the GNU GPL, which makes it free software. The free in free software refers to liberty, not price As some GNU project advocates like to point out, think of free speech rather than free beer In short, you have the right freedom to run and change grep and distribute it to other people, and if you want charge money for doing either The important restriction is that you have to grant your recipients the same rights and impose the same restrictions. This general method of licensing software is sometimes called open source The GNU project prefers the term free software for reasons outlined at. This manual is free documentation in the same sense The documentation license is included below The license for the program is available with the source code, or at.6 1 GNU Free Documentation License. Version 1 3, 3 November 2008.The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of copyleft , which means that derivative works of the document must themselves be free in the same sense It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation a free program should come with manuals providing the same freedoms that the software does But this License is not limited to software manuals it can be used for any textual work, regardless of subject matter or whether it is published as a printed book We recommend this License principally for works whose p urpose is instruction or reference. APPLICABILITY AND DEFINITIONS. This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein The Document , below, refers to any such manual or work Any member of the public is a licensee, and is addressed as you You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A Modified Version of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and or translated into another language. A Secondary Section is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document s overall subject o r to related matters and contains nothing that could fall directly within that overall subject Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The Invariant Sections are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant The Document may contain zero Invariant Sections If the Document does not identify any Invariant Sections then there are none. The Cover Texts are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under thi s License A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A Transparent copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or for images composed of pixels generic paint programs or for drawings some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent An image format is not Transparent if used for any substantial amount of text A copy that is not Transparent is called Opaque. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input forma t, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification Examples of transparent image formats include PNG, XCF and JPG Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The Title Page means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page For works in formats which do not have any title page as such, Title Page means the text near the most prominent appearance of the work s title, preceding the beginning of the body of the text. The publisher means any person or entity that distributes copies of the Document to the public. A section Entitled XYZ means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language Here XYZ stands for a specific section name mentioned below, such as Acknowledgements , Dedications , Endorsements , or History To Preserve the Title of such a section when you modify the Document means that it remains a section Entitled XYZ according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this Lice nse applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute However, you may accept compensation in exchange for copies If you distribute a large enough number of copies you must also follow the conditions in section 3.You may also lend copies, under the same conditions stated above, and you may publicly display copies. COPYING IN QUANTITY. If you publish printed copies or copies in media that commonly have printed covers of the Document, numbering more than 100, and the Document s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover Both covers must also clearly and legibly identify you as the publisher of these copies The front cover must pr esent the full title with all words of the title equally prominent and visible You may add other material on the covers in addition Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed as many as fit reasonably on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material If you use the latter option, you must take reasonably prudent steps, when yo u begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy directly or through your agents or retailers of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it In addition, you must do these things in the Modified Version. Use in the Title Page and on the covers, if any a title distinct from that of the Docum ent, and from those of previous versions which should, if there were any, be listed in the History section of the Document You may use the same title as a previous version if the original publisher of that version gives permission. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document all of its principal authors, if it has fewer than five , unless they release you from this requirement. State on the Title page the name of the publisher of the Modified Version, as the publisher. Preserve all the copyright notices of the Document. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document s license notice. Include an unaltered copy of this License. Preserve the section Entitled History , Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page If there is no section Entitled History in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on These may be placed in the History section You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the v ersion it refers to gives permission. For any section Entitled Acknowledgements or Dedications , Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and or dedications given therein. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles Section numbers or the equivalent are not considered part of the section titles. Delete any section Entitled Endorsements Such a section may not be included in the Modified Version. Do not retitle any existing section to be Entitled Endorsements or to conflict in title with any Invariant Section. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant To do this, add their titles to the list of Invariant Sections in the Modifie d Version s license notice These titles must be distinct from any other section titles. You may add a section Entitled Endorsements , provided it contains nothing but endorsements of your Modified Version by various parties for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version Only one passage of Front-Cover Text and one of Back-Cover Text may be added by or through arrangements made by any one entity If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author s and publisher s of the Do cument do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled History in the various original documents, forming one section Entitled History likewise combine any sections Entitled Acknowledgements , and any sections Entitled Dedications You must delete all sections Entitled Endorsements. COLLECTIONS OF DOCUMENTS. You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that d ocument. AGGREGATION WITH INDEPENDENT WORKS. A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an aggregate if the copyright resulting from the compilation is not used to limit the legal rights of the compilation s users beyond what the individual works permit When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form Otherwise they must appear on printed covers that bracket the whole aggregate. Translation is considered a kind of modi fication, so you may distribute translations of the Document under the terms of section 4 Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled Acknowledgements , Dedications , or History , the requirement section 4 to Preserve its Title section 1 will typically require changing the actual title. You may not copy, modify, sublicense, or distribute the Document excep t as expressly provided under this License Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated a provisionally, unless and until the copyright holder explicitly and finally terminates your license, and b permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License for any work from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. FUTURE REVISIONS OF THIS LICENSE. The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns See. Each version of the License is given a distinguishing version number If the Document specifies that a particular numbered version of this License or any later version applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published not as a draft by the Free Software Foundation If the Document does not specify a version number of this License, you may choose any version ever published not as a draft by the Free Software Foundation If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy s public statement of acceptance of a version permanently authorizes you to choose that version for the Document. Massive Multiauthor Collaboration Site or MMC Site means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works A public wiki that anybody can edit is an example of such a server A Massive Multiauthor Collaboration or MMC contained in the site means any set of copyrightable works thus published on the MMC site. CC-BY-SA means the Creative Commons Attribution-Share Alike 3 0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. Incorporate means to publish or republish a Document, in wh ole or in part, as part of another Document. An MMC is eligible for relicensing if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, 1 had no cover texts or invariant sections, and 2 were thus incorporated prior to November 1, 2008.The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM How to use this License for your documents. To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the with Texts line with this. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those tw o alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.

No comments:

Post a Comment