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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to compare null and space using single if condition jayakumarrt UNIX for Dummies Questions & Answers 3 05-16-2008 06:13 AM
Replace blank spaces by single tab, and right alignment Jae Shell Programming and Scripting 1 08-08-2007 11:58 PM
how to read double consecutive space in filename for bash shell james_falco UNIX for Dummies Questions & Answers 1 07-17-2007 05:32 PM
replacing single space in argument convenientstore Shell Programming and Scripting 7 04-25-2007 02:02 PM
single input shell script? quipy Shell Programming and Scripting 1 10-03-2002 09:18 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-31-2007
NinersFan NinersFan is offline
Registered User
  
 

Join Date: Aug 2007
Location: Toronto
Posts: 3
Consecutive spaces within input being converted to single space

I'm reading from a file that is semi-colon delimited. One of the fields contains 2 spaces separating the first and last name (4th field in - "JOHN<space><space> DOE"):

e.g. TORONTO;ONTARIO;1 YONGE STREET;JOHN DOE;CANADA

When I read this record and either echo/print to screen or write to output, the 2 spaces get converted to a single space. I need to keep all spaces intact when writing to output.

Here's a snippet of code I'm using. I'm attempting to load a series of records into an array with the purpose of performing logic on the contents and then outputting to several different output(s):

exec 3<$1 # Open input
exec 4>$1.out # Open output
let CNF_REC_CNT=CNF_REC_CNT+1
read -u3 REC_BUF[CNF_REC_CNT]
print "Buffer is : "${REC_BUF[CNF_REC_CNT]}""

How do I get around this?
 

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 09:21 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