Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Concatenate multiple files

  1. #1

    Default Concatenate multiple files

    Hi.
    Please guide me.
    I've got a job running several transformations which writes out a couple of XML files each into the same directory -- ${Internal.Job.Filename.Directory}/ . Now looking at the following code from the Execute a shell script step:

    echo "<ContainedResourceList>" >> dd.xml
    cat SR.xml >> dd.xml

    echo "</ContainedResourceList>" >> dd.xml
    echo "<ContainedReleaseList>" >> dd.xml
    cat R.xml >> dd.xml

    echo "</ContainedReleaseList>" >> dd.xml
    cat SRH.xml >> dd.xml
    cat RT.xml >> dd.xml
    cat SRF.xml >> dd.xml

    Problem is, we are now running on Windows platform. Does anyone know how concatenate the above 5 xml files to dd.xml within the Kettle Job? Looks like the Javascript step is the only way forward...

    -Look forward to hear from you. Cheers!
    Last edited by dat789; 09-29-2011 at 07:40 AM. Reason: additional information

  2. #2
    Join Date
    Sep 2011
    Posts
    190

    Default

    If you like you can do pretty much the same on Windows. Instead of 'cat' it's 'type', but redirection (>>) etc. works in a Dos box too.

  3. #3

    Default

    Tried both 'cat' and 'type' as suggested.

    Here's the error log.

    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : Unexpected error running shell [null] : java.lang.Exception: Unable to create temporary file to execute script
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : java.lang.Exception: Unable to create temporary file to execute script
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.entries.shell.JobEntryShell.createTemporaryShellFile(JobEntryShell.java:727)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.entries.shell.JobEntryShell.executeShell(JobEntryShell.java:502)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.entries.shell.JobEntryShell.execute(JobEntryShell.java:447)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:471)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:600)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:600)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:600)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:600)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:600)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:600)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.execute(Job.java:344)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.Job.run(Job.java:282)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : Caused by: org.apache.commons.vfs.FileSystemException: Could not create file "file:///C:/file:/C:/Users/MyName/Documents/My Reports/dd/kettle_da65e87c-eaa5-11e0-b834-0d571b641de0shell.bat".
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFile(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.pentaho.di.job.entries.shell.JobEntryShell.createTemporaryShellFile(JobEntryShell.java:706)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : ... 11 more
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : Caused by: org.apache.commons.vfs.FileSystemException: Could not create folder "file:///C:/file:".
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.createFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : ... 13 more
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : Caused by: org.apache.commons.vfs.FileSystemException: Could not create directory "C:\file:".
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : at org.apache.commons.vfs.provider.local.LocalFile.doCreateFolder(Unknown Source)
    2011/09/29 15:18:07 - Concatenate Files - ERROR (version 4.1.4, build 15682 from 2011-08-22 10.41.59 by tomcat) : ... 22 more

    Any ideas?

  4. #4
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Instead of trying to join them outside of PDI, why not join them INSIDE PDI?

  5. #5

    Default

    ... and how is this done, please?

  6. #6
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Look at the samples that came with PDI. There are examples of how to make multilevel XML in there.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.