添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
想发财的脸盆  ·  Windows10 MYSQL ...·  7 月前    · 
仗义的单车  ·  openlayers ...·  9 月前    · 
愉快的核桃  ·  批量大小不匹配·  11 月前    · 

Newbie to PowerShell. I want to filter in column 1 where value in a text file equal "Find"

    Get-Content -Path C:\home\file.csv | Select-String -SimpleMatch "Find"

When I ran the above script it returns all records in column 1 that equal "Find" and other columns that have "Find", it should only return column 1 where value is "Find"

Please can you help?

This works. How do I export result to csv. Out-File maintains the same staggered format but not comma seperated – Olu Akin Nov 16 '17 at 11:33

Use Import-csv:

Import-Csv C:\home\file.csv -Header Col1,Col2,Col3 | Select-Object -Unique Col1 | Select-String -SimpleMatch "Find"

Adjust the header columns to the columns you have. I assume you have no headers in the csv. otherwise it would be even easier.

I was about to write that, but you already gave that answer.Good call mate – Ranadip Dutta Nov 16 '17 at 11:31

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.2.12.36053