Count the Lines
Easy · Pipelines & Redirection · wc · Redirection
Problem
Print the number of lines in data.txt, and nothing else.
wc -l data.txt would print the filename too. Redirect the file into wc instead, so only the number appears.
Examples
Input: data.txt with 3 lines Output: 3
Approaches
- Redirect into wc
Related problems
Start free on Cariara · Coding problems · System design studio