Hi Paul,
Thanks for the help. I was hoping to accomplish this with MySQl, but in the
end a script works just as good and this is just the first of several I am
using. For what it's worth I ended up using sed. Here is is if somone else
could use it:
sed "s/ /|/g"
^This is a tab, not spaces..
I am now confronted with another problem. I need to also provide a CSV
version.
I need to use , seperated and " protected text. I have a copy of phpMyAdmin
that will
export to this format, but I need to use this at the shell.
I haven't yet dug into the script to se if this done with PHP or MySQL. I am
thinking it is probably done with PHP.
I noticed a mention of MySQL being able to set a delim in the docs but alas
they never actually say how.
Finally, I considered using awk for this but I am running into a problem
there as well
since "'s are used to protect text. For instance
awk '{print """$1""","""$2"""} would print the fields correctly if not for
the " issue.
A shove in the right direction would sure be appreciated.
Thanks,
-Eric
> -----Original Message-----
> From: Paul DuBois [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 02, 2001 9:38 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: specifying a delimiter
>
>
> At 9:11 PM -0500 5/2/01, Paul DuBois wrote:
> >At 10:01 AM -0500 5/2/01, [EMAIL PROTECTED] wrote:
> >>Hi,
> >>Being new to MySQL, I am having a problem getting output from it to the
> >>shell that is formatted the way I need. I need a table to be
> written to a
> >>file with a delimiter.
> >>something like :
> >>
> >>#!/bin/sh
> >>mysql -uroot -ptest database < sql
> >>
> >>Then I run that script like this:
> >>./script.sh > output.txt
> >>
> >>Any delimiter is ok except for tab. Is this possible?
> >>Thanks, in advance,
> >
> >
> >Not with mysql by itself. You can use sed or tr to change
> >the tab in mysql's output to something else. The syntax for
> >tr varies among systems, but on one of my systems (RedHat),
> >both of these work:
> >
> >mysql .... < sql | tr '\t' :
> >
> >mysql .... < sql | tr '\011' :
> >
> >--
> >Paul DuBois, [EMAIL PROTECTED]
>
> Er, I should have been more specific and said "both of these work to
> change tabs to colons". Substitute whatever other character you wish.
> Sorry.
>
> --
> Paul DuBois, [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php