wc कमांड
wc एक counter जैसा है जो आपको बताता है कि किसी text में कितनी lines, words या letters हैं। यह एक chain के आखिर में देखने के लिए handy है कि कितना through आया।
In this page:
Syntax
wc [-l | -w | -c] file_name
wc
wc अपने input में lines (-l), words (-w), और characters/bytes (-c) count करता है। इसे अक्सर एक pipeline के आखिर में रखा जाता है यह summarize करने के लिए कि previous filtering steps से कितना data through आया।
बिना किसी flags के इसे run करना तीनों counts साथ में print करता है।
Note:
command | wc -l यह count करने का standard idiom है कि एक command ने कितनी lines produce की।उदाहरण: wc
#!/bin/bash
printf "one\ntwo\nthree\n" > words.txt
echo "Lines: $(wc -l < words.txt)"
echo "Words: $(wc -w < words.txt)"
echo "Characters: $(wc -c < words.txt)"
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
wc -lउपयोग करना और यह उम्मीद करना कि trailing newline के बिना last line count होगी।wc -l fileoutput को सिर्फ एक number के रूप में पढ़ना, जब इसमें file name भी शामिल होता है।-c(bytes) और-m(characters) को confuse करना।
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: