Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Copy command which merges several files tags the word SUB at the end  (Read 19453 times)

0 Members and 2 Guests are viewing this topic.

houseofthesun1

    Topic Starter


    Starter

    The command

    copy  c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_list*.csv c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_List.csv  /Y

    copies several files into one file, but at the end there is a blank line with the word SUB.

    Is  SUB a control character?
    The only other control chars I see are CR and LF....which is of course not a problem

    Thanks in advance for any help regarding this problem!

    Salmon Trout

    • Guest
    Re: Copy command which merges several files tags the word SUB at the end
    « Reply #1 on: January 31, 2010, 09:06:00 AM »
    SUB is a control character; ASCII 26 decimal, 1A hex, also called Control-Z. It is appended by the copy command in text (default) mode. To avoid it use copy with the /b (binary) switch.

    Code: [Select]
    copy /b c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_list*.csv c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_List.csv  /Y
    Code: [Select]
    Dec  Hex  Unicode Char  Name
    0 00 U+0000 NUL Null
    1 01 U+0001 STX Start of Header
    2 02 U+0002 SOT Start of Text
    3 03 U+0003 ETX End of Text
    4 04 U+0004 EOT End of Transmission
    5 05 U+0005 ENQ Enquiry
    6 06 U+0006 ACK Acknowledge
    7 07 U+0007 BEL Bell
    8 08 U+0008 BS BackSpace
    9 09 U+0009 HT Horizontal Tabulation
    10 0A U+000A LF Line Feed
    11 0B U+000B VT Vertical Tabulation
    12 0C U+000C FF Form Feed
    13 0D U+000D CR Carriage Return
    14 0E U+000E SO Shift Out
    15 0F U+000F SI Shift In
    16 10 U+0010 DLE Data Link Escape
    17 11 U+0011 DC1 Device Control 1 (XON)
    18 12 U+0012 DC2 Device Control 2
    19 13 U+0013 DC3 Device Control 3 (XOFF)
    20 14 U+0014 DC4 Device Control 4
    21 15 U+0015 NAK Negative acknowledge
    22 16 U+0016 SYN Synchronous Idle
    23 17 U+0017 ETB End of Transmission Block
    24 18 U+0018 CAN Cancel
    25 19 U+0019 EM End of Medium
    26 1A U+001A SUB Substitute
    27 1B U+001B ESC Escape
    28 1C U+001C FS File Separator
    29 1D U+001D GS Group Separator
    30 1E U+001E RS Record Separator
    31 1F U+001F US Unit Separator
    « Last Edit: January 31, 2010, 09:45:11 AM by Salmon Trout »

    houseofthesun1

      Topic Starter


      Starter

      Re: Copy command which merges several files tags the word SUB at the end
      « Reply #2 on: January 31, 2010, 10:27:54 PM »
      Thanks SO MUCH for your help !!!  :) (|   

      By the way, the /b worked  when I put it on the end of the command (for the destination file).

      I have another question.

      Even now when I requested "binary" mode, the CR LF control characters still appear (that is a good thing!)

      Aren't they ascii control characters also?

      What is this control-z character for in the first place?

      When would I ever want to have the character at the end of my text?

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Copy command which merges several files tags the word SUB at the end
      « Reply #3 on: January 31, 2010, 11:27:16 PM »
      Thanks SO MUCH for your help !!!  :) (|   

      By the way, the /b worked  when I put it on the end of the command (for the destination file).

      I have another question.

      Even now when I requested "binary" mode, the CR LF control characters still appear (that is a good thing!)

      Aren't they ascii control characters also?

      What is this control-z character for in the first place?

      When would I ever want to have the character at the end of my text?

      the "EOF marker" (ctrl-Z) is a holdover from CP/M; with CP/M, files could only be allocated in blocks the size of a disk sector. Because of that, it was necessary to indicate where the data actually ended. To do this, programs padded off the unused space in the last sector of a file with EOF marks (Ctrl-Z). when they read the file, they would read until they found an EOF mark and then stop.

      DOS kept the convention only for convenience with porting CP/M applications, by tradition text files all end with an EOF mark, and copy honours this.

      Note that /B treats the data as binary data, and therefore copies all of it; the extra eof mark you see without the /B switch is copy treating it as a text file and appending the EOF marker as a sort of convenience to programs that read until an EOF marker rather then the real end of file. Also, note that using copy to append two files, as in "copy file1+file2 resultfile" will not work properly without the /b switch in some circumstances; for example, if you try to combine two files that are non-text files or contain EOF markers within the text. Copy only copies each file until it finds an EOF mark, and writes them to the new file.
      I was trying to dereference Null Pointers before it was cool.

      houseofthesun1

        Topic Starter


        Starter

        Re: Copy command which merges several files tags the word SUB at the end
        « Reply #4 on: February 01, 2010, 01:02:23 AM »
        Thanks for sharing your knowledge!!

        I look forward to helping others too!

         :D