in reply to Removing matched pattern except the first pattern

You're asking a strange question... Why use a pattern to do this at all?

In this case, you want to capture everything from line 3 onwards, so why not use the $. variable which captures the line #, and save all the lines where $.>2? Or just use a variable to count the lines and save lines based on the counter value?

If you HAVE to do this with a regex for the lines to exclude, you still don't need to count anything - just exclude anything matching /procs|swpd/ for example...


Mike
  • Comment on Re: Removing matched pattern except the first pattern