Double space


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Double space
# 1  
Old 11-19-2009
Double space

Hi.

this is my code:
Code:
set common2 = "1  2 3 4"
echo $common2

you can see that between 1 and 2 there is double space
but the output is
Code:
1 2 3 4

and not
Code:
1  2 3 4

what is the problam???

Last edited by Franklin52; 11-19-2009 at 09:42 AM.. Reason: Please use code tags!
# 2  
Old 11-19-2009
Quote:
Originally Posted by nirnir26
you can see that between 1 and 2 there is double space
No I can't see it.

Quote:
Originally Posted by nirnir26
but the output is 1 2 3 4
and not 1 2 3 4
This looks the same too.

Please use code-tags.

---------- Post updated at 02:44 PM ---------- Previous update was at 02:35 PM ----------

Try

Code:
printf "$common2"


Last edited by Scott; 11-19-2009 at 09:56 AM.. Reason: changed variable name
# 3  
Old 11-19-2009
its not helps..
# 4  
Old 11-19-2009
Try this:

Code:
[root@wiki ~]# common2="1  2 3 4"
[root@wiki ~]# echo "$common2"
1  2 3 4

# 5  
Old 11-19-2009
Quote:
Originally Posted by nirnir26
its not helps..
I know the C-shell (which it looks like you're using) is funny, but quoting the variable does preserve the whitespace.

Code:
% set common2 = "1  2 3 4"
% echo $common2
1 2 3 4
% echo "$common2"
1  2 3 4
%

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

2. UNIX for Dummies Questions & Answers

Replacing double spaces with single space

I am looking for a regular expression that uses sed to replace multiple spaces with single spaces on every line where it is not at the start of the line and not immediately before double slashes ('//') or between quotes ("). In its simplest form, it would look like this: sed -e 's# # #g'... (4 Replies)
Discussion started by: figaro
4 Replies

3. Fedora

Need to incrwase PHYSICAL VOLUME space on hard drive with free space on it

Hi, I run Fedora 17. I created a physical volume of 30GB on a disk with 60GB of space so there is 30GB of free space. On the physical volume, I created my volume group and logical volumes. I assigned all the space in the physical volume to my volume group. I need to add the 30GB of free space... (1 Reply)
Discussion started by: mojoman
1 Replies

4. Shell Programming and Scripting

Replace newline character between a double quotes to a space

Hi Guys, I have a file with content as below aj.txt "Iam allfine" abcdef abcd "all is not well" What I'm trying to say is my data has some new line characters in between quoted text. I must get ride of the newline character that comes in between the quoted text. output must be:... (8 Replies)
Discussion started by: ajahuja
8 Replies

5. UNIX for Dummies Questions & Answers

Remove two delimiters, space and double quotes

I would like to know how to replace a space delimiter with a ^_ (\037) delimiter and a double quote delimiter while maintaining the spaces inside the double quotes. The double quote delimiter is only used on text fields. I'd prefer a one-liner, but could handle a function or script that accepts... (4 Replies)
Discussion started by: SteveDWin
4 Replies

6. Shell Programming and Scripting

nested double quota and white space inside variable

I have a question about nested double quotes. Any help is appreciated. Here are my commands on Mac OS. # string="Ethernet \"USB Ethernet\" \"Bluetooth DUN\" AirPort FireWire \"Bluetooth PAN\"" # echo $string Ethernet "USB Ethernet" "Bluetooth DUN" AirPort FireWire "Bluetooth PAN" #... (3 Replies)
Discussion started by: lindazhou
3 Replies

7. Shell Programming and Scripting

Replace Double space with ||

Hi Guys, I am trying to replace Double space with ||. But even the single space is getting replace with |. Can you please point out my mistake. I am trying to do it with translate command tr " " "||" Regards, Magesh (4 Replies)
Discussion started by: mac4rfree
4 Replies

8. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

9. UNIX for Dummies Questions & Answers

how to read double consecutive space in filename for bash shell

Hello, Im using cygwin app which we use the bash shell for scripting. Im trying to read a filename with consecutive spaces on the filename ex: filename<space><space>1.txt ls -lrt filename<space><space>1.txt is working but when I pull that from a file and place it into variable. it reads... (1 Reply)
Discussion started by: james_falco
1 Replies

10. Shell Programming and Scripting

remove files with 0 size, space and double qoute

os=hpux11 shell=ksh some jokers had written thousands of empty files into my $HOME. and the files are named inconsistently that some of them include space and double qoutes. all those files are of 0 size (when i did ls -al it told me so). the naming paterns are like e.g of ls -al output: ... (3 Replies)
Discussion started by: nongrad
3 Replies
Login or Register to Ask a Question