How do I read a text file in Unix?

How do I read a text file in Unix?
Answer
Syntax: Read file line by line on a Bash Unix & Linux shell:
  1. The syntax is as follows for bash, ksh, zsh, and all other shells to read a file line by line.
  2. while read -r line; do COMMAND; done < input.file.
  3. The -r option passed to read command prevents backslash escapes from being interpreted.
19 окт. 2020 г.
 

Tìm kiếm

Back
Top