Extract lines from a file in bash -


I have such a file

I would like to extract with line 0 and 1 (file All the rows in) though in a separate file, the sequence does not start with 0, but it can also start with 1. However, the line always comes straight after the line (site). Besides, I would like to extract the CITTE line in a different file. Does anyone tell me how is this possible?

In addition, I want to remove CITET line in a separate file

This is a simple part:

  grep '^ SITE:' infile & gt; Outfile.site  

is a little harder: remove after line:

  grep --after-context = 1 '^ Site: 'Infail' | Grep '^ [01] * $' \ & gt; Outfile.nr  

- The context after (or -A ) specifies that followed by In addition to printing the match line, we again use the second grep to print that line, and in fact the matching line (and not the delimiter grep Each <-context )

Alternatively, you can use the following to match the numerical rows:

  grep '^ [01] * $' infile & gt; It is very easy, but it will only get  all  lines together with <0 and 1, even if they come after a line, regardless of the  site: . 


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -