Help with Editing the Content


I am working on a PS Script that removes the , from the data and replaces it with a tab space.

The issue is there are commas in the address field that i do not want to be replaced but want every other comma on the file to be replaced with a tab.

Please assist.

No Data
  • This is kind of old-school, but I couldn't think of a better way:

    $string = "asdf,1234,XZVC,rerere,8d8d8d8,987,h87,vveqfv3q,dsafyerf";
    $array = $string -split ",";
    $output = "";
    (0..($array.count-2)) | % {
    $i = $_;
    $output += $array[$i];
    if (($i % 2) -eq 0) { $output += "," } else { $output += "`t" }

    $output += $array[$array.count - 1];

    The $ouput variable will be the same as $string but with every other comma replaced with a tab.

No Data