Ihe Nlereanya Iwu WC 6 iji gụta ọnụọgụ ahịrị, okwu, mkpụrụedemede na Linux
A na-eji iwu wc (ọnụọgụ okwu) dị na sistemụ arụmọrụ Unix/Linux iji chọpụta ọnụọgụgụ ọnụọgụ ọhụrụ, ọnụọgụ okwu, byte na mkpụrụedemede n'ime faịlụ akọwapụtara site na arụmụka faịlụ. Syntax nke iwu wc dị ka egosiri n'okpuru.
# wc [options] filenames
Ndị a bụ nhọrọ na ojiji nke iwu nyere.
wc -l : Prints the number of lines in a file. wc -w : prints the number of words in a file. wc -c : Displays the count of bytes in a file. wc -m : prints the count of characters from a file. wc -L : prints only the length of the longest line in a file.
Yabụ, ka anyị hụ ka anyị nwere ike isi jiri 'wc' iwu ya na arụmụka ole na ole dịnụ na ihe atụ dị n'isiokwu a. Anyị ejirila faịlụ 'tecmint.txt' maka ịnwale iwu ndị a. Ka anyị chọpụta mmepụta nke faịlụ site na iji iwu cat dị ka egosiri n'okpuru.
cat tecmint.txt Red Hat CentOS Fedora Debian Scientific Linux OpenSuse Ubuntu Xubuntu Linux Mint Pearl Linux Slackware Mandriva
1. Ihe Nlereanya bụ isi nke WC Command
Iwu 'wc' na-agafeghị oke ọ bụla ga-egosipụta nsonaazụ bụ isi nke faịlụ tecmint.txt'. Nọmba atọ egosiri n'okpuru bụ 12 (ọnụọgụ ahịrị), 16 (ọnụọgụ okwu) na 112 (ọnụọgụ bytes) nke faịlụ ahụ.
wc tecmint.txt 12 16 112 tecmint.txt
2. Ọnụ ọnụọgụgụ ahịrị
Iji gụọ ọnụọgụ ọhụrụ ahịrị ọhụrụ na faịlụ jiri nhọrọ '-l', nke na-ebipụta ọnụọgụ ahịrị site na faịlụ enyere. Kwuo, iwu a ga-egosipụta ọnụọgụ ahịrị ọhụrụ na faịlụ. Na mmepụta nke mbụ etinyere dị ka ọnụ ọgụgụ na mpaghara nke abụọ bụ aha faịlụ.
wc -l tecmint.txt 12 tecmint.txt
3. Ngosipụta Ọnụọgụgụ Okwu
Iji arụmụka '-w' na iwu 'wc' na-ebipụta ọnụọgụ okwu dị na faịlụ. Pịnye iwu a ka ịgụọ mkpụrụokwu dị na faịlụ.
wc -w tecmint.txt 16 tecmint.txt
4. Gụọ Ọnụọgụ Bytes na Characters
Mgbe ị na-eji nhọrọ '-c' na '-m' nwere iwu 'wc' ga-ebipụta ọnụọgụ bytes na mkpụrụedemede n'otu n'otu na faịlụ.
wc -c tecmint.txt 112 tecmint.txt
wc -m tecmint.txt 112 tecmint.txt
5. Ngosipụta Ogologo Ogologo Ogologo Ahịrị
Iwu 'wc' na-enye ohere arụmụka '-L', enwere ike iji ya bipụta ogologo ahịrị ogologo (ọnụọgụ mkpụrụedemede) na faịlụ. Yabụ, anyị nwere ahịrị agwa kachasị ogologo ('Linux sayensị') na faịlụ.
wc -L tecmint.txt 16 tecmint.txt
6. Lelee Nhọrọ WC ndị ọzọ
Maka ozi ndị ọzọ na enyemaka na wc iwu, dị mfe na-agba ọsọ 'wc -help' ma ọ bụ 'man wc' site na ahịrị iwu.
wc --help Usage: wc [OPTION]... [FILE]... or: wc [OPTION]... --files0-from=F Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input. -c, --bytes print the byte counts -m, --chars print the character counts -l, --lines print the newline counts -L, --max-line-length print the length of the longest line -w, --words print the word counts --help display this help and exit --version output version information and exit Report wc bugs to [email GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> For complete documentation, run: info coreutils 'wc invocation'