Hi, On Sat, Jun 20, 2009 at 5:13 PM, Ralf Wildenhues <ralf.wildenh...@gmx.de>wrote:
> Hello Rita, > > please don't top-post (put your answer above the text you reply to), > thank you. > > * Rita Shen wrote on Fri, Jun 19, 2009 at 02:29:05AM CEST: > > I tried the command: > > > > awk 'BEGIN { RS="\&"};{ > > gsub(/\[[\n]+\]/, "");print $0}' gawk_test > gawk_modi > > > > But the content in gawk_modi is still the same as the gawk_test: > > > > <"Reports" [ > > > > > > > > ]> > > Hmm, that's weird, because for me, the above works. However, I do get a > warning from awk: > awk: warning: escape sequence `\&' treated as plain `&' > > > By the way, what's the difference between RS and FS? > > RS is the record separator, while FS is the field separator. Records > are commonly lines, while fields are commonly words in a line, at least > that's how I interpret them. Since you can change RS, FS, as well as > ORS and OFS (the corresponding output separators), they can of course > delimit different chunks of text. But the general idea is that a file > is composed of zero or more records, and a record composed of zero or > more fields. > > The gawk manual is pretty good about this stuff: > <http://www.gnu.org/software/gawk/manual/> > > Hope that helps. > > Cheers, > Ralf > In case that someone may be encountering similar problems. Finally this problem was resolved after adding carriage return in the command: awk 'BEGIN {RS="&"};{gsub(/[\r]*[\n]*/, "");print $0}' gawk_test > gawk_modi Cheers, Rita