I have a CSV file containing products, this CSV file has a column for brands and a column for categories. I'm trying to run a foreach loop to remove the brand names from the categories column.
$products = import-csv X:\products.csv
$brands = $products.Brand | sort | select -unique
foreach ($item in $products) {
$item.categories = $item.categories.Replace("Coming Soon","")
$item.categories = $item.categories.Replace($brands,"")
}
The "Coming Soon" gets removed, but all the brand names that are containd in $brands still remain.
Where am I going wrong?