Question: Suppose I have a text file with the following format 

```
@ATDGGSGDTSG
NTCCCCC
+
@nddhdhnadn
@ATDGGSGDTSG
NTCCCCC
+
nddhdhnadn

```

Now its a repeating pattern of "4" lines and I every time want to print only the 2nd line i.e. the line after the line starting with "@" i.e 2nd line..6th line..etc.

How can I do it?

Answer: 
With `awk`:

```
$ awk 'NR%4==2' a
NTCCCCC
NTCCCCC

```

`NR` stands for number or record, in this case being number of line. Then, if we divide it by 4, we get all lines whose modulus is 2.

---

### Update on your comment

> 
> And wat if I want the output to be > "nextline" NTCCCCC > "nextline"
>  NTCCCCC i.e. I want to add ">" before that line while redirecting the
>  output.
> 
> 
> 

This way, for example:

```
$ awk 'NR%4==2 {print ">"; print $0}' a
>
NTCCCCC
>
NTCCCCC

```

---

Another example:

```
$ seq 30 | awk 'NR%4==2' 
2
6
10
14
18
22
26
30

```
You could have a variable like `$printNextLine` and loop over all your Input, Setting it to `1` whenever you see a line with @ and printing the current line while Setting the variable back to `0` if it is `1`.

Not as effective and short as the other answers but maybe more intuitive for someone new to perl.