how to preserve all spacings in the file content, when parsing through i
From:
Ante Bilandzic
Subject:
how to preserve all spacings in the file content, when parsing through it with while + read
Date:
Fri, 7 Jun 2024 12:12:15 +0200
Hello,
This is the content of example file.txt:
The shell is both an interactive command language
and a scripting language, and is used by the operating system to
control the execution of the system using shell scripts.
I would like to parse through it using while + read, but also to preserve
all original spacings in the file. It seems, however, that all spacings at
the very beginning of the lines are gone, while all other spacings are
preserved:
$ while read Line; do echo "$Line"; done < file.txt
The shell is both an interactive command language
and a scripting language, and is used by the operating system to
control the execution of the system using shell scripts.
Is there an easy way to preserve original spacings also at the beginning of
the lines, when parsing with while + read?
Thanks!
Cheers,
Ante