# Search value in a CSV file and do something with it!

**URL:** <https://forums.powershell.org/t/search-value-in-a-csv-file-and-do-something-with-it/5865>\
**Category:** PowerShell Help\
**Created:** [February 26, 2016, 2:01am UTC](https://forums.powershell.org/t/search-value-in-a-csv-file-and-do-something-with-it/5865 "2016-02-26T02:01:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [February 26, 2016, 2:01am UTC](https://forums.powershell.org/t/search-value-in-a-csv-file-and-do-something-with-it/5865/1 "2016-02-26T02:01:58Z")

</div>

Hi PowerGEEKS,

I want te following thing to do

I have a list of customers and prices view example below

number Price  
10071 30.00  
10071 5.00  
10071 4.00  
10071 0.00  
10071 4.00  
10071 3.75  
10071 15.89  
10071 0.00  
10297 0.00  
10297 0.00  
10297 0.00  
10297 0.00

Table 2  
number Totalpricel  
10071 46,75  
10297 0

I want to import a CSV file then select the number ( customer number) inc. price and make a total price of it in another CSV file. Is this possible? Or do I need to use another programming language?

import-csv -path C:\temp\gegevens1.csv | select-object custumernumber, price | export-csv -path.

I hope my question is clear

Kind regards,

Gijs Liefers (Dutch name)

---

<div class="post-metadata">

**Author:** ![random-commandline](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@random-commandline](https://forums.powershell.org/u/random-commandline)\
**Post date:** [February 26, 2016, 2:51am UTC](https://forums.powershell.org/t/search-value-in-a-csv-file-and-do-something-with-it/5865/2 "2016-02-26T02:51:11Z")

</div>

```
# Export customer and price totals
$groups = Import-Csv "C:\temp\gegevens1.csv" | Group-Object -Property customernumber
$groups | ForEach-Object {$measure = $_.group | Measure-Object -Property price -Sum 
[pscustomobject]@{'customer number' = $_.name;
                'total price'=$measure.Sum}} | 
Export-Csv -Path "C:\temp\gegevens1_total.csv" -NoTypeInformation -Append
```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:42pm UTC](https://forums.powershell.org/t/search-value-in-a-csv-file-and-do-something-with-it/5865/3 "2024-05-16T20:42:46Z")

</div>


