Hi,
I've been going crazy trying to figure out what I'm doing wrong with gawk here. Would appreciate any feedback I could get on this.
Given an input file like this:
Code:
*******************************************
*******************************************
foo bar
something something
*.somewhere.com
foo again
*******************************************
*******************************************
foo bar
*.somewhereelse.com
some more stuff
*******************************************
*******************************************
I want to read it in with gawk and use the two lines of asterisks as the record separator (RS). Here's what I've got so far, but it only creates one record in awk every time I try it:
Code:
gawk -W dump-variables=awk.out 'BEGIN {RS="^\*+"} {
print $0
print NR
print "\n"
}'
Output:
Code:
*******************************************
*******************************************
foo bar
something something
*.somewhere.com
foo again
*******************************************
*******************************************
foo bar
*.somewhereelse.com
some more stuff
*******************************************
*******************************************
1
What am I doing wrong with the RS regular expression?