Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keep spaces in text file 1

Status
Not open for further replies.

jescat

Technical User
Jul 29, 2004
32
US
All,

I have an input file:

$cat t.txt
A B C D

$cat t.sh
while read line
do
echo $line
done < t.txt

$./t.sh
A B C D

My question is: How do I "keep" the spaces? I would like the variable to hold the entire formatted line of the input file ("A B C D"). I know I can use awk, however would like to know if I can do in shell.

Thanks
JS


 
echo "$line"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top