Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Custom Delimiters ?

Closed Thread
 
Thread Tools Display Modes
Old 05-23-2008   #1 (permalink)
dm_14
Guest


 

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.

Old 05-23-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 

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
Old 05-23-2008   #3 (permalink)
Flowering Weeds
Guest


 

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!


Old 05-26-2008   #4 (permalink)
dm_14
Guest


 

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!
>
>
>
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Delimiters or Separators. Where defined? SteveL Vista General 4 04-13-2008 07:53 AM
types.custom.ps1xml for custom members hasten PowerShell 0 02-25-2008 08:30 PM
Custom WDS Rules Tim Haughton Vista file management 0 12-23-2007 02:00 AM
Using Custom Command in EID viRtual Avalon 0 08-01-2006 03:13 AM
Custom Dependency Property in custom class hierarchy not workingcorrectly?! MueMeister Avalon 0 03-02-2006 06:19 PM








Vistax64.com 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 2005-2008

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 47 48 49 50