0

Using awk is it doable to separate values based on a certain record?

Let's say we have following file:

ACCJSH PREMIUM
I5001
7
5976
7
@#
0.2
5195
5231
0.2
@#
39
5197
39
@#

If we take the @# for example, groups will be:

ACCJSH PREMIUM
I5001
7
5976
7

and

0.2
5195
5231
0.2

and

39
5197
39

1 Answer 1

4

You just need to set Record Separator variable, either at start in the BEGIN section or with -v option:

$ awk -vRS='@#' 1 file
CCJSH PREMIUM
I5001
7
5976
7

0.2
5195
5231
0.2

39
5197
39

In the same manner you can set Output Record Separator.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.