View Single Post
Old 10-11-2008   #2 (permalink)
Flowering Weeds
Guest


 
 

Re: How do I filter rows in one csv file matching a value in another

Quote:

>
> Can someone please help me
> get the following done in Powershell:
>
> I'v got this in a csv file (RefVal.csv):
Mmm data parsing!

Perhaps do it the same way one
would do this in almost any Windows
process - by using a data parsing tool.

Here using the automation tool
powershell.exe
_automating_ a data parsing tool
logparser.exe:

$headers = LogParser "SELECT text
FROM RefValContent.csv
WHERE index = 1" `
-i textline -q on

" "
LogParser.exe "SELECT $headers
FROM RefValContent.csv
WHERE RefValC IN
(Select RefVal FROM RefVal.csv) " `
-i csv -stats off

" "
"Done!"
" "
Exit

Returns:

RefValC Col1 Col2
------- ------------ ------------
1 Col1Content1 Col2Content1
2 Col1Content2 Col2Content2
3 Col1Content3 Col2Content3
5 Col1Content5 Col2Content5
7 Col1Content7 Col2Content7
9 Col1Content9 Col2Content9

Done!

Have some fun
data parsing,
plus charting,
and report making,
all by using Log Parser!


My System SpecsSystem Spec