in reply to Re: part - split up files according to column value
in thread part - split up files according to column value

I have just found this piece of code and it is perfect for a regular task I have. However I am struggling to get headers to work. If I use the header-line switch it ignores the headline for file creation but it does not seem to paste the header in to the top of each file it is creating. Any advice?
  • Comment on Re^2: part - split up files according to column value

Replies are listed 'Best First'.
Re^3: part - split up files according to column value
by Corion (Patriarch) on Feb 08, 2011 at 12:05 UTC

    jdporter's program has no option for headers. Did you mean to reply to my program?

    If so, please do consider telling me how you invoke the program, and what the layout of the first few rows of your input file is and what you get for output, so that I can reproduce the problem.

      Yes - sorry I was referring to your program Corion. I invoke it using the following: part.pl filename -header-line=1 -column=3 The first line of the file contains the header. The output files are all correct, except for the lack of header. Here is sample input field1 field2 field3 split zweiradlinss 89803607 330525685618 3 zweiradlinss 89803607 310286767428 77 I am splitting on the last column. It generates two files. One for line 2 and another for line 3. Neither has the header row.

        Sorry terrible formatting. Input file is

        field1 field2 field3 split

        zweiradlinss 89803607 330525685618 3

        zweiradlinss 89803607 310286767428 77