Question: How can I revert the order of some blocks of text using only bash commands like sed and cat? What I want is something like tac, but instead of operating line by line, it would operate block by block. Example:

**From**

```
/Section 3/
Rabbits
Dogs
Cats

/Section 2/
Eagles
Mice

/Section 1/
Dogs
Rabbits
Lemmings

```

**To**

```
/Section 1/
Dogs
Rabbits
Lemmings

/Section 2/
Eagles
Mice

/Section 3/
Rabbits
Dogs
Cats

```

In some files, the beginning of the block is marked by a slash, as in the example above. In others, the blocks are marked only by the existence of one or more blank lines between them.

Answer: 
If there are blank lines separating all blocks,

```
awk 'BEGIN{ORS=RS RS;RS=""}{a[NR]=$0}END{for(i=NR;i>0;i--)print a[i]}'

```
Use `csplit` to split them into separate files, put the generated filenames into another file, then use `tac` to get the filenames to merge.