473,790 Members | 2,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tabs missing in batch mode

Hi,

in a shell script of mine I'm executing a mysql SELECT in batch mode. I
want to use the return value for other sql statements.

The problem I'm facing is that the tabs, which seperate the columns
from each other, are missing in the output.

What am I doing wrong?

#!/bin/sh
QUERY="select id, i.handle from idmap i, person p where
i.handle=p.hand le and email=\"$1\""
mysql mydatabase -pmypassword -N -B -e "$QUERY" | while read line ; do
personid=$(echo $line | cut -f1) ; handle=$(echo $line | cut -f2 ) ;
echo $handle ; done ;
Fritz

Apr 24 '06 #1
2 1376
fr*********@web .de wrote:
Hi,

in a shell script of mine I'm executing a mysql SELECT in batch mode. I
want to use the return value for other sql statements.

The problem I'm facing is that the tabs, which seperate the columns
from each other, are missing in the output.

What am I doing wrong?

#!/bin/sh
QUERY="select id, i.handle from idmap i, person p where
i.handle=p.hand le and email=\"$1\""
mysql mydatabase -pmypassword -N -B -e "$QUERY" | while read line ; do
personid=$(echo $line | cut -f1) ; handle=$(echo $line | cut -f2 ) ;
echo $handle ; done ;


Try echo "$line" instead of echo $line. The whitespace is being
interpreted by the shell. The shell interprets any amount of whitespace
as equivalent to one space, unless you protect it with quoting.

For example, try the following, typing a tab character where I indicate
"\t" below:

$ echo one \t two \t three

Now try it with quotes:

$ echo "one \t two \t three"

Regards,
Bill K.
Apr 24 '06 #2
Thanks a lot, that caused the problem.

Apr 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
3505
by: Moosebumps | last post by:
So, after reading some messages about os.system, and looking at the popen stuff and trying it a bit, I still have not found a way to keep a command window open for several commands (on Windows 2000/XP), while seeing the normal output in a command window. All I want to do is do what a batch file does, but I want to actually have functions and associative arrays and all the other niceties of python. What's the deal with that? I thought...
5
2052
by: Tyler Hudson | last post by:
After reading Erland Sommarskog's most enlightening articles on SQL Server 2000's error handling capabilities (http://www.sommarskog.se/error-handling-I.html and http://www.sommarskog.se/error-handling-II.html) I have a question regarding batch cancellation caused by a client. Because a batch cancel request from a client does not cause a rollback, is there any danger of the commands that were executed in the batch before the client...
1
5795
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try to call the batch file, it just returns with a return code of 1. When I call cmd.exe, and pass the batch file as a parameter it hangs. After much frustration and aggrevation, I found that CMD IS in fact running, but it is running under the context...
12
5147
by: Selva Chinnasamy | last post by:
Hi I am using batch commands against Ms-Access and getting an error Message "Characters found after end of SQL statement." String Here is my sql Dim str_screens As String = "Select * from Screens Order by ScreenName;Select * from Functions" How can I fix this problem. Any help is greatly appreciated. Selva
135
7532
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about which is better. It has become what's known as “religious war” — a heated fight over trivia. In this essay, i like to explain what is the situation behind it, and which is proper.
0
1726
by: ee_stevek | last post by:
hi guys, here is my problem: i have to maintain a web vb.net application developped some times ago. The application was developped on Windows2000 SP3 with Visual Studio 2003 (7.1). and the application was running on windows 2000 SP3 with the usual IIS. Right now i need to make it work, on a Windows 2003 SP1 server (but i need the keep the dev environment on VisualStudio 2003). this app need to run some batch file, unfortunately for me,...
35
2730
by: Ben | last post by:
Hi, I have a python script on a unix system that runs fine. I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. I now want to run them on the same system, actually in the same script by combining bits and pieces. But whatever I try my windows tabs get converted to spaces when I transfer it to the unix system and the interpreter complains that the indentation style is not consistent...
16
2748
by: Richard Maher | last post by:
Hi, I have this Applet-hosted Socket connection to my server and in an ONevent/function I am retrieving all these lovely rows from the server and inserting them into the Select-List. (The on screen appearance of the Select List grows for the first 5 rows then the scroll bar appears if there's more). So far so good. . . The problem is that none of the rows I'm inserting appear on the screen until I have RETURNed from my function; so If...
1
4568
by: sansaniwal12 | last post by:
I have installed db2top on solaris 10 and i trying to run db2top in batch mode. I tried with following option for batch mode: db2top -d UBIS -u db2das -p db2das -i 3 -b l -X -o db2top.xml -m 10 But still this utility runs in interactive mode. could someone suggest me how can i run db2top in batch mode. Best Regards, Deepak Sansaniwal
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10413
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.