• Nick Brinsko (Customer)

    You could do this with the built in find/replace script as long as there are no values which also contain commas.

  • Trent Brazeal (Customer)

    I know I'm late to the game here. I'm sure you have what you need by now. I would be curious what solution you have in place today.

     

    We are new customers to MOVEit and I just came across this thread. See below for what we use. It defaults to convert comma delimited to pipe delimited, but you can specify the source and target delimiter via parameters.

    This script is courtesy of Tony Perri at Progress. He provided this during our PoC because this was one of our requirements.

    1. try{
    2. #get the cachefile name
    3. $inputFile = $miaclient.MICacheFilename()
    4.  
    5. #get a new cache file name
    6. $outputFile = $miaclient.MINewCacheFilename()
    7. #get the delimiters
    8. $inputDelimiter = $miaClient.MIGetTaskParam("InputDelimiter")
    9. if (-not $inputDelimiter) {
    10. $inputDelimiter = ','
    11. }
    12. $outputDelimiter = $miaClient.MIGetTaskParam("OutputDelimiter")
    13. if (-not $outputDelimiter) {
    14. $outputDelimiter = '|'
    15. }
    16. $miaclient.MILogMsg("About to convert $cachefile from '$inputDelimiter' to '$outputDelimiter'")
    17. Import-CSV -Delimiter $inputDelimiter -Path $inputFile | Export-CSV -Delimiter $outputDelimiter -NoTypeInformation -Path $outputFile
    18. $miaclient.MIReplaceCacheFile($outputFile)
    19. } catch {
    20. $miaclient.MISetErrorCode(10000)
    21. $miaclient.MISetErrorDescription("Error: " + $_)
    22. }

     

  • Michael Deering (Lifepoint Health)

    This will convert CSV to Pipeline Delimited ignoring anything with double quotes. Works on MoveIT Automation 2024

     

    #==============================================================

    # Script to convert from CSV to Pipeline delimited

    #==============================================================

    Try {

       $miaclient.MILogMsg("Converting $fileToConvert from CSV to Pipeline delimited")   

       $fileToConvert = $miaClient.MICacheFilename()

       $miaClient.MILogMsg("Full fileToConvert = $fileToConvert")

       foreach($path in $fileToConvert){

     

           $miaClient.MILogMsg("fileToConvert = $path")

           $fileContent   = Import-Csv -Path "$path"

           $miaClient.MILogMsg("Full fileContent = $fileContent");

           $newFilePath = $($(Split-Path -Path $path)+"\Converted-"+$(Split-Path -Path $$path -Leaf))

           $fileContent | export-csv -Delimiter "|" -Path $newFilePath -NoTypeInformation

           $miaclient.MIReplaceCacheFile($newFilePath)

       }

       $miaClient.MILogMsg( "File(s) converted to Pipeline delimited successfully ")     

    }

    Catch{

       # 10000 is a suggested error code for errors in user scripts.

       $miaclient.MISetErrorCode(10000)

       $miaclient.MISetErrorDescription("Error: " + $Error)

    }

    RETURN

     

    #End of Script

    #------------------------------------------------------------