Forrest logo
back to the cat tool

cat:ai:402c6

write a shell script that can take each line of a text file and output a new file containing the line.
$ cat input.txt | while read line; do echo $line >> output.txt; done
try on your machine

This shell script reads each line from 'input.txt' file and appends it to 'output.txt' file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • write a shell script that can take each line of a text file and output a new file containing the line.?
back to the cat tool