No announcement yet.

Help with FileReader and writer

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with FileReader and writer

    I am receiving a text file. The first three lines of the file are patient information and after that, it contains the patient test result which is tab delimited (/t). I need to save the patient information from the top and then delete the first 3 lines and save the file as is.

    I created one file reader and was able to store the first three line values in a variable for later use but it's not deleting the line 2. In addition to that, it's also removing /n after each line and in the output file, it saves the entire file as a single line instead of keeping the file as is. I need the file as is in the tab-delimited format after deleting the top three lines.

    Can someone point out my mistake? I did try to play around with set data type options under summery but no luck so far.

    I am using 3.7.0. Please see the attached channel and the sample test file.
    Attached Files

  • #2
    Suggest that you might find it easier to do this with a shell script and then run that script from the channel.

    I would use either the sed or awk commands in the script.


    • #3
      This is windows environment running windows 10.


      • #4

        this should do it.
        Attached Files


        • #5
          You are awesome works perfectly. The only question I have is I use encoding as Default for the file but you used ISO-8859-15 can you explain why and how to determine which to use.
          Last edited by Mits87; 04-16-2019, 12:19 AM.


          • #6
            If you use default encoding Mirth will use the charset the java vm is running with. Under Linux this is mostly UTF-8 - under Windows this is most likely Windows 1272(in western Europe).
            Choosing a charset depends on the encoding of your messages - in Germany this is nearly always ISO-8859-15.
            So if you know the charset of your messages - that's the one to use.


            • #7
              Thanks for the explanation. I think this will help me a lot in the future.