diff --git a/src/sort.c b/src/sort.c
index 7e25f6a..b3553bf 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -441,6 +441,7 @@ Other options:\n\
       fputs (_("\
   -k, --key=POS1[,POS2]     start a key at POS1 (origin 1), end it at POS2\n\
                             (default end of line).  See POS syntax below\n\
+  -l, --skip-lines=NUM      skip NUM number of lines from each file before sorting\n\
   -m, --merge               merge already sorted files; do not sort\n\
 "), stdout);
       fputs (_("\
@@ -501,7 +502,7 @@ enum
   PARALLEL_OPTION
 };
 
-static char const short_options[] = "-bcCdfghik:mMno:rRsS:t:T:uVy:z";
+static char const short_options[] = "-bcCdfghik:l:mMno:rRsS:t:T:uVy:z";
 
 static struct option const long_options[] =
 {
@@ -515,6 +516,7 @@ static struct option const long_options[] =
   {"general-numeric-sort", no_argument, NULL, 'g'},
   {"ignore-nonprinting", no_argument, NULL, 'i'},
   {"key", required_argument, NULL, 'k'},
+  {"skip-lines",required_argument,NULL,'l'},
   {"merge", no_argument, NULL, 'm'},
   {"month-sort", no_argument, NULL, 'M'},
   {"numeric-sort", no_argument, NULL, 'n'},
@@ -1390,6 +1392,18 @@ specify_nthreads (int oi, char c, char const *s)
   return nthreads;
 }
 
+/* Specify the number of lines to skip before sorting.  */
+static unsigned long int
+specify_nline_skip (int oi, char c, char const *s)
+{
+  unsigned long int nline_skip;
+  enum strtol_error e = xstrtoul (s, NULL, 10, &nline_skip, "");
+  if (e == LONGINT_OVERFLOW)
+    return ULONG_MAX;
+  if (e != LONGINT_OK)
+    xstrtol_fatal (e, oi, c, long_options, s);
+  return nline_skip;
+}
 
 /* Return the default sort size.  */
 static size_t
@@ -1687,7 +1701,7 @@ limfield (struct line const *line, struct keyfield const *key)
    Return true if some input was read.  */
 
 static bool
-fillbuf (struct buffer *buf, FILE *fp, char const *file)
+fillbuf_skip (struct buffer *buf, FILE *fp, char const *file,unsigned long int *nline_skip)
 {
   struct keyfield const *key = keylist;
   char eol = eolchar;
@@ -1738,6 +1752,15 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
                     *ptrlim++ = eol;
                 }
             }
+          /*skip header lines*/
+          while(*nline_skip > 0 && (p = memchr (ptr, eol, ptrlim - ptr)))
+            {
+              *p = '\0';
+              ptr = p + 1;
+              line_start = ptr;
+              buf->nlines--;
+              (*nline_skip)--;
+            }
 
           /* Find and record each line in the just-read input.  */
           while ((p = memchr (ptr, eol, ptrlim - ptr)))
@@ -1800,6 +1823,14 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
     }
 }
 
+static bool
+fillbuf (struct buffer *buf, FILE *fp, char const *file)
+{
+  unsigned long int nline_skip = 0;
+  return(fillbuf_skip(buf,fp,file,&nline_skip));
+}
+
+
 /* Table that maps characters to order-of-magnitude values.  */
 static char const unit_order[UCHAR_LIM] =
   {
@@ -3643,7 +3674,7 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles,
 
       if (nopened == nfiles)
         {
-          FILE *ofp = stream_open (output_file, "w");
+          FILE *ofp = stream_open (output_file, "a");
           if (ofp)
             {
               mergefps (files, ntemps, nfiles, ofp, output_file, fps);
@@ -3687,21 +3718,15 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles,
 
 static void
 sort (char * const *files, size_t nfiles, char const *output_file,
-      unsigned long int nthreads)
+      unsigned long int nthreads, unsigned long int nline_skip)
 {
   struct buffer buf;
   size_t ntemps = 0;
   bool output_file_created = false;
+  size_t totalFiles = nfiles;
 
   buf.alloc = 0;
 
-  while (nfiles)
-    {
-      char const *temp_output;
-      char const *file = *files;
-      FILE *fp = xfopen (file, "r");
-      FILE *tfp;
-
       size_t bytes_per_line;
       if (nthreads > 1)
         {
@@ -3718,14 +3743,41 @@ sort (char * const *files, size_t nfiles, char const *output_file,
       else
         bytes_per_line = sizeof (struct line) * 3 / 2;
 
+  while (nfiles)
+    {     
+      char const *temp_output;
+      char const *file = *files;
+      FILE *fp = xfopen (file, "r");
+      FILE *tfp;
+
       if (! buf.alloc)
         initbuf (&buf, bytes_per_line,
                  sort_buffer_size (&fp, 1, files, nfiles, bytes_per_line));
       buf.eof = false;
+
+      bool fillbufResult;
+      unsigned long int lines_skipped = nline_skip;
+      
+      if(totalFiles == nfiles)
+        {
+          lines_skipped = 0;
+          fillbufResult = fillbuf (&buf, fp, file);
+          tfp = xfopen (output_file, "w");
+          struct line* tmp_line = buffer_linelim(&buf);
+          for(size_t i=0;i<nline_skip;i++)
+            write_unique (tmp_line-(1+i),tfp,output_file);
+          
+          xfclose(tfp,output_file);
+          buf.nlines-=nline_skip;
+          buf.alloc-=nline_skip * sizeof(struct line);
+        }
+      else
+        fillbufResult = fillbuf_skip (&buf, fp, file,&lines_skipped);
+      
       files++;
       nfiles--;
 
-      while (fillbuf (&buf, fp, file))
+      while (fillbufResult)
         {
           struct line *line;
 
@@ -3744,7 +3796,7 @@ sort (char * const *files, size_t nfiles, char const *output_file,
           if (buf.eof && !nfiles && !ntemps && !buf.left)
             {
               xfclose (fp, file);
-              tfp = xfopen (output_file, "w");
+              tfp = xfopen (output_file, "a");
               temp_output = output_file;
               output_file_created = true;
             }
@@ -3780,6 +3832,8 @@ sort (char * const *files, size_t nfiles, char const *output_file,
 
           if (output_file_created)
             goto finish;
+
+          fillbufResult = fillbuf_skip (&buf, fp, file,&lines_skipped);
         }
       xfclose (fp, file);
     }
@@ -3990,6 +4044,7 @@ main (int argc, char **argv)
   bool need_random = false;
   unsigned long int nthreads = 0;
   size_t nfiles = 0;
+  unsigned long int nline_skip = 0;
   bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
   bool obsolete_usage = (posix2_version () < 200112);
   char **files;
@@ -4267,6 +4322,10 @@ main (int argc, char **argv)
           insertkey (key);
           break;
 
+        case 'l':
+          nline_skip = specify_nline_skip(oi,c,optarg);
+          break;
+
         case 'm':
           mergeonly = true;
           break;
@@ -4534,7 +4593,7 @@ main (int argc, char **argv)
       if (!nthreads || nthreads > np2)
         nthreads = np2;
 
-      sort (files, nfiles, outfile, nthreads);
+      sort (files, nfiles, outfile, nthreads, nline_skip);
     }
 
   if (have_read_stdin && fclose (stdin) == EOF)
