The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to append spaces(say 10 spaces) at the end of each line based on the length of th prathima UNIX for Dummies Questions & Answers 17 01-28-2009 04:10 PM
including spaces in awk output prkfriryce Shell Programming and Scripting 4 03-12-2007 09:32 AM
Reading a path (including ref to shell variable) from file lojzev Shell Programming and Scripting 1 09-10-2006 11:05 PM
prob with spaces in reading a file Amardeep Shell Programming and Scripting 2 05-23-2006 11:54 AM
Read files including spaces kumariak Shell Programming and Scripting 4 06-08-2005 07:36 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-19-2007
aksarben aksarben is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 1
Reading a line including spaces

Hi All,

I have a script that reads a file and echo it back to std out.

Test.txt

1aaaaaaaaaaa .

The script is ReadLine.sh

#!/bin/ksh

cat $1 | while read file
do
echo $file
done

I invoke the script as ReadLine.sh Test.txt

The output that I get is

1aaaaaaaaaaa .

The read command seems to truncate the spaces and I need to print all the spaces between the text and the '.'

Any ideas.
Thanks
Ben.
  #2 (permalink)  
Old 09-19-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
It's not the read, it's the shell expansion and argument handling in the echo line.

Try

Code:
echo "$file"
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0