in reply to Keep only X number of entries of a file using a delimeter
# Entry 1 ... # Entry 2 ...
You can use $/ aka the Input record separator:
perl -pe 'BEGIN { $/ = "#" } exit if $. > 500' input-file
$. contains the record number.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Keep only X number of entries of a file using a delimeter
by Anonymous Monk on Oct 13, 2015 at 14:19 UTC | |
by choroba (Cardinal) on Oct 13, 2015 at 14:26 UTC |