Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Custom Delimiters ?

Reply
 
Old 05-23-2008   #1 (permalink)
dm_14


 
 

Custom Delimiters ?

Hi

I have an query that run against SQL Server and returns a DataSet, I can
output the results to a csv file using,

$Results.tables[0] | Export-Csv ("c:\test.csv")

Some of the columns have dollar amounts e. Jim, money, $1,400 and that is
interpreted incorrectly in excel. Is there a way to specify an alternative
delimiter like | a pipe, so that it appears as Jim| money| $1,4000 with the
$1,400 intact ?

Thanks.


My System SpecsSystem Spec
Old 05-23-2008   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: Custom Delimiters ?

dm_14 wrote:
Quote:

> Hi
>
> I have an query that run against SQL Server and returns a DataSet, I can
> output the results to a csv file using,
>
> $Results.tables[0] | Export-Csv ("c:\test.csv")
>
> Some of the columns have dollar amounts e. Jim, money, $1,400 and that is
> interpreted incorrectly in excel. Is there a way to specify an alternative
> delimiter like | a pipe, so that it appears as Jim| money| $1,4000 with the
> $1,400 intact ?
>
> Thanks.
>
As for export-csv, v2 CTP2's export-csv now has a new -delimiter tab
which allows for using something other than "," to seperate stuff.

So this would work:
PSHv2 CTP2> $results.tables[0]|export-csv -delimiter "|" c:\test.csv

Willing to try CTP2 on a non-production machine? If not, there should
be another method...

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 05-23-2008   #3 (permalink)
Flowering Weeds


 
 

Re: Custom Delimiters ?

Quote:

> Is there a way to specify an alternative
> delimiter like | a pipe,
Yes, the Windows data parsing tool,
IIS's Microsoft's (local or remote) data
parser, Log Parser 2.2 (with built-in
Microsoft ChartSpace chart maker)
can do what one wants!

-o:tsv -oSeparator:"|"

PowerShell users use Log Parser
just like PowerShell users use IE,
ChartSpace, Excel, Word, NetStat.exe
or MSBuild.exe or WinRM and so on!

Notice: IIS does not need to be running
or installed in order to use Log Parser
for either data parsing or chart making.

Search the Internet
(and this newsgroup)
for usage of:

Microsoft's Log Parser
command line usage,
or fully script enabled
either in COM or .NET
(from the IIS group)

Remember, ever since PowerShell
added HTTP / HTTPS usage (like IIS)
Log Parser became PowerShell's data
parser (like Log Parser is for IIS) too!


My System SpecsSystem Spec
Old 05-27-2008   #4 (permalink)
dm_14


 
 

Re: Custom Delimiters ?

Hi Flowering Weeds,

Could you please provide a short working example ?

Thanks.

"Flowering Weeds" wrote:
Quote:

>
Quote:

> > Is there a way to specify an alternative
> > delimiter like | a pipe,
>
> Yes, the Windows data parsing tool,
> IIS's Microsoft's (local or remote) data
> parser, Log Parser 2.2 (with built-in
> Microsoft ChartSpace chart maker)
> can do what one wants!
>
> -o:tsv -oSeparator:"|"
>
> PowerShell users use Log Parser
> just like PowerShell users use IE,
> ChartSpace, Excel, Word, NetStat.exe
> or MSBuild.exe or WinRM and so on!
>
> Notice: IIS does not need to be running
> or installed in order to use Log Parser
> for either data parsing or chart making.
>
> Search the Internet
> (and this newsgroup)
> for usage of:
>
> Microsoft's Log Parser
> command line usage,
> or fully script enabled
> either in COM or .NET
> (from the IIS group)
>
> Remember, ever since PowerShell
> added HTTP / HTTPS usage (like IIS)
> Log Parser became PowerShell's data
> parser (like Log Parser is for IIS) too!
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Custom TraceListener using custom LogEntry .NET General
Accessing custom types output from custom cmdlet's in C# GUI PowerShell
Word Delimiters or Separators. Where defined? Vista General
types.custom.ps1xml for custom members PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46