Computer Science, asked by Niyardas5433, 1 year ago

Write a command to redirect the number of lines of a file "input.txt" to the file "output.txt".

Answers

Answered by Jatinrana11
8
"text to find" input.txt > output.txt ... To output to a file, redirect sed 's stdout to a file using the > operator .

harshitsingh10pa0o9m: I didn't get you. Please elaborate.
Answered by hotelcalifornia
14

Answer:

The command to "redirect the number of lines" of a file "input.txt" to the file is  

cat <input_file> | wc -l > <output_file>  

After executing the above command, the output file will contain the number of lines in an input file.

Example: If an input file has 26 number of lines, then after executing the command, the output file will have 26 written within it.

Another command wc -l <input_file>  >  <output_file> will write the file name of the input file as well after the line count within output file.

Similar questions