Skip to main content
typo
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k

Would this help?

perl - e '
           $num1 = 5;
           $num2= 10000;
           open IN,"<","input_file.txt";
           open OUT,">","output_file.txt";
           print OUT <IN> for (1 .. $num1-1)
           <IN> for ($num1 .. $num2);
           undef $/ and print OUT <IN>;
           close IN;
           close OUT;
          '

This removes any lines between 5 and 10000 inclusive. Change the numbers to fit your needs. Can't see an efficient way of doing it in situ, though (i.e. this approach will have to print to a different output file).

Would this help?

perl - e '
           $num1 = 5;
           $num2= 10000;
           open IN,"<","input_file.txt";
           open OUT,">","output_file.txt";
           print OUT <IN> for (1 .. $num1-1)
           <IN> for ($num1 .. $num2);
           undef $/ and print OUT <IN>;
           close IN;
           close OUT;
          '

This removes any lines between 5 and 10000 inclusive. Change the numbers to fit your needs. Can't see an efficient way of doing it in situ, though (i.e. this approach will have to print to a different output file).

Would this help?

perl -e '
           $num1 = 5;
           $num2= 10000;
           open IN,"<","input_file.txt";
           open OUT,">","output_file.txt";
           print OUT <IN> for (1 .. $num1-1)
           <IN> for ($num1 .. $num2);
           undef $/ and print OUT <IN>;
           close IN;
           close OUT;
          '

This removes any lines between 5 and 10000 inclusive. Change the numbers to fit your needs. Can't see an efficient way of doing it in situ, though (i.e. this approach will have to print to a different output file).

Source Link
Joseph R.
  • 40.5k
  • 8
  • 113
  • 146

Would this help?

perl - e '
           $num1 = 5;
           $num2= 10000;
           open IN,"<","input_file.txt";
           open OUT,">","output_file.txt";
           print OUT <IN> for (1 .. $num1-1)
           <IN> for ($num1 .. $num2);
           undef $/ and print OUT <IN>;
           close IN;
           close OUT;
          '

This removes any lines between 5 and 10000 inclusive. Change the numbers to fit your needs. Can't see an efficient way of doing it in situ, though (i.e. this approach will have to print to a different output file).