Questions tagged [wc]

`wc` is a standard POSIX command that counts words, lines, and characters.

The wc utility reads one more files (or the standard input) and writes the number of lines, words, and characters to the standard output. If more than one file is given, then the total number of lines, words, and characters across all inputs will also be printed. There are also switches for controlling what parts should be counted.

Some versions of wc can differentiate between characters (which may be multi-byte depending on the encoding) and bytes.

References:

350 questions
-3
votes
1 answer

How to find linecount in Perl?

How do I find out linecount in perl similar to what wc -l gives me. A method preferably that doesn't require reading the whole file.
vatsal
  • 109
  • 2
  • 12
-4
votes
4 answers

Is there a way to seek the "\n" character that is faster than looping through char one at a time?

Looking at the sample implementation of wc.c when counting number of lines, it loop through the file, one character at a time and accumulating the '\n' to count the number of newlines: #define COUNT(c) \ ccount++; \ if ((c)…
alvas
  • 115,346
  • 109
  • 446
  • 738
-4
votes
2 answers

How To Compare Number Of Lines In 2 Files Using IF/Then Bash Command

I would like to compare the line counts of two separate files. While I have tried using wc -l in the comparison, I'm struggling to get it working properly. I have: if [ "$(wc -l file1.txt)" == "$(wc -l file2.txt)" ]; then echo "Warning: No Match!";…
DomainsFeatured
  • 1,426
  • 1
  • 21
  • 39
-4
votes
1 answer

Is there a way to use woocommerce forms on other template?

I need to create a full registration page on my woocommerce site, and, I want to show the default WC forms, eg. form with address autoclomplete, state dropdown list etc... Please, this is my last big achievement to complete this project. Will…
-4
votes
1 answer

Bash script to email when wc -l count is below 3

Please, can you help me with a script that counts something (wc -l) and when the count is below 3 the script emails me. Thank you!
1 2 3
23
24