Format output issue

Dear Friends,
Need your help.

$cat input.txt
            TITLE
                       Date:01-01-2011
		       Day: Friday
Details		Particulares           Qty
$
$
$
$
$
$more test.sh
cat input.txt | while read line
do
echo "${line}"
done
$
$
$
$sh test.sh
TITLE
Date:01-01-2011
Day: Friday
Details		Particulares           Qty
$
$

However we want it to be like original file with spaces. Here in our script space before "TITLE", "DATE", "Day" is ignored.

Please help.
Anu

what's wrong with simply using cat <somefile> ?

I suppose the OP needs to apply some logic while processing the file content (i.e. and this is only an example).

To the OP, most probably you don't need cat at all in this case:

while IFS= read -r; do 
  printf "%s\n" "$REPLY"
done < infile
  1. Some shells doesn't provide read -r (so you'll need to remove the -r).
  2. Some shells raise an error if read is used without an explicit argument (varname), in that case you should use one.

not sure how you've managed to interpret so much from such a vague request.....
and your answer is riddled with caveats, i recommend the requester restate the requirement in the name of clarity.

I suppose it's just because it's hard to believe that someone will ever need a code like that.

Could you be more specific?

Yes, it may be hard to believe (and 100% with you on that), in which case I will either ignore the request or ask the submitter to restate removing ambiguity.

I think giving answers with the likes of the above is asking for trouble, simply give an example that works, let the submitter try them out. if you are being specific, ie command XXXX only tested/works on OS zzzz version xxxx and ....., then don't answer, ask the submitter for clarifications.

all that said, isn't great being able to help - i love it.