我正在试图在 Csv 文件的行数中找到超过一定值的行数。
$T6=Import-Csv $file | Where-Object {$_."Value" -ge 0.6 } | Measure-Object
这对较小的文件非常有效, 但对于大 Csv 文件( 1 GB 或更多), 它会永远运行 。 在 powershell 中, 是否有更好的方法来解析这样的 csv 文件?
我正在试图在 Csv 文件的行数中找到超过一定值的行数。
$T6=Import-Csv $file | Where-Object {$_."Value" -ge 0.6 } | Measure-Object
这对较小的文件非常有效, 但对于大 Csv 文件( 1 GB 或更多), 它会永远运行 。 在 powershell 中, 是否有更好的方法来解析这样的 csv 文件?
导入 Csv 是此内容的官方 cmdlet 。 但有一个评论是, 所有导入的都是字符串, 所以您最好将“ 价值” 属性投向正确的类型 。 例如 :
$T6 = Import-Csv $file | Where-Object { [float]$_.Value -ge 0.6 } | Measure-Object
您可以尝试除去 Import-Csv
:
$values = ([System.IO.File]::ReadAllText( c:pstNew Microsoft Office Excel Worksheet.csv )).Split(";") | where {$_ -ne ""}
$items = New-Object "System.Collections.Generic.List[decimal]"
foreach($value in $values)
{
[decimal]$out = New-Object decimal
if ([System.Decimal]::TryParse($value, [ref] $out))
{
if ($out -ge 10){$items.Add($out)}
}
}
$items | Measure-Object
为了快速处理大型文件时考虑使用溪流阅读器, Roman s ans answer
I ve been working on this simple code that puts a CSV file into a nice table. But because the data is imported, styling ODD rows is a pretty hard thing to do.
All I need would be a method to address ...
What would be the most efficient way to clean a user input that is a comma separated string made entirely on numbers - e.g
2,40,23,11,55
I use this function on a lot of my inputs
function clean($...
Below is the sample csv file
date,type1,type2,.....
2009-07-01,n1,n2,.....
2009-07-02,n21,n22,....
and so on...
I want to add the values in each row and each column and print at the end and bottom ...
I am getting this sort of CSV data while making Http request to the CSV file. Very malformed string.
response = "Subject";"Start Date";"Start Time";"End Date";"End Time";"All day event";"...
I m stumped with a problem illustrated in the sample below:
"ID","NAME","PHONE","REF","DISCARD"
1,"JOHN",12345,,
2,"PETER",6232,,
3,"JON",12345,,
4,"PETERSON",6232,,
5,"ALEX",7854,,
6,"JON",12345,,
...
I’m at a very basic level with Flex and with programming in general. I am working on a project where I have data in an Excel (.csv) format, it’s a large Excel plot/matrix where each cell has a ...
I have some text file like this, with several 5000 lines:
5.6 4.5 6.8 "6.5" (new line)
5.4 8.3 1.2 "9.3" (new line)
so the last term is a number between double quotes.
What I want to do is, ...
Is there a PHP string function that transforms a multi-line string into a single-line string?
I m getting some data back from an API that contains multiple lines. For example:
<p>Some Data</...