All the documentation i have found says use double quotes and in fact when i tried using a single character as a RS it gave give me a syntax error if i used single quotes, so im confused as to why \n is different.Is this specific to ksh or am i doing something wrong?
It is not restricted to AIX. The standards explicitly state that the input Record Separator is the 1st character or the string assigned to RS and the results are unspecified if the string assigned to RS contains more than one character. Some implementations of awk allow using an ERE in RS (which is required by the standards for FS , but not for RS ). The behavior you are seeing on AIX is common for most implementations of awk on UNIX and BSD systems. Most, if not all, Linux systems support the extension that allows RS to be set to an ERE.
With a standards-conforming awk :
awk '
c == 0 {
f1 = $0
c = 1
next
}
c == 1 {
print f1 $0
c = 2
}
NF == 0 {
c = 0
}' file1
should do what you want.
If someone wants to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk .