简体   繁体   中英

comparing two text files' contents using PowerShell

I am having two text files having comma separated data.I want to compare and find out the difference between these two files' content. How to do this with using PowerShell. I am getting the rows count as per below code:

$rows = Get-Content "D:\FCA\FCA_node_final.txt" 
$rows.count

$rows = Get-Content "D:\FCA\FCA.txt" 
$rows.count

here am getting the count 358 and 379 i want to get the remaining 21 rows. here is the format of file :

Pre-Validation/MIS,MIS,MIS
Pre-Validation/MIS/Reports,Reports,Reports
Pre-Validation/PBGSBLC,PBGSBLC,PBG/SBLC
/PBGSBLC/SBLCBGdetails,SBLCBGdetails,SBLC/BG details

您可以使用Compare-Object cmdlet

Compare-Object -referenceobject $(get-content "D:\FCA\FCA_node_final.txt") -differenceobject $(get-content "D:\FCA\FCA.txt")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM