[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading whitespaces and beginning and end of line
From: |
Pierre Gaston |
Subject: |
Re: reading whitespaces and beginning and end of line |
Date: |
Fri, 7 Dec 2007 21:56:05 +0200 |
On Dec 7, 2007 12:49 PM, sancho1980 <martin.knappe@gmail.com> wrote:
> The problem I have occurs whenever there is a whitespace at the end of a
> line in the input file, because this whitespace get automatically truncated
> from "$line", and i dont want that..i want the whole line to go into
> outfile, no matter if the last characters are whitespace!
read the documentation of read.
you can either use
while read -r ;do echo "$REPLY";done
or
while IFS='' read -r line;do echo "$line";done