record separator

can anyone tell me any way to change record separator (default is new line).
RS in nawk as not working.
Thanks in advance.

Regards
Rochit

could you define 'not working', pls?
An example might be helpful.

P.S. The 'out-of-the-box' awk's can only define RS as single characters - no regex for RS.

my in put file is:

<CRM:MS=23746,............................;
<EN:MS=23746..........................;
................................................;
<CRM:5766,..............;
<OP:.................................;

my input file looks like this. in place of dots there are some more parameters.
what i want is that the record separator new line (currently ) is replaced. i want the script to accept <CRM: as new field separatori.e my output file should look like:

<CRM:MS=23746,............................;<EN:MS=23746..........................;................................................;
<CRM:5766,..............;<OP:.................................;

it will be very nice of you if you can help.

Regards
Rochit

use 'gawk' if you can:

#
# set the RecordSeparator to '<CRM:'
#
# for the FIRST line - reevaluate the record equal to itself
# for any OTHER line - reevaluate the record appending the RecordSeparator
# to the beginning of the record.
#
# after the reevaluattion is done - PRINT the record. 'PRINT' is implicit as a
# result of the record re-evaluation.
#
gawk -v RS='<CRM:' '$1=(FNR==1) ? $1 : RS $1' myFile

or with any other awk without using an RS:

# for the FIRST line/record - print it out (withOUT a new line) and o to the next line
FNR==1 { printf ;next }
#
# for any OTHER (other than the first) line/record:
# if the line/record starts with '<CRM:' - print the new line '\n' followed by
# a line itself.
# if the line/record does NOT start with '<CRM:' - print the line withOUT
# a new line '\n'
{printf (/^<CRM:/) ? "\n" $0 : $0}

# print new line '\n' after the LAST line processed
END { printf "\n" }

please could you explain the working of both the codes.

Regards
Rochit

see above.

thanks alot.

Code looks fine. i'll try it and come back to you tommorrow.
thanks for the explanation too.

Thanks alot
for the time being code is working perfectly

Regards
Rochit