The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: AWK scripting
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 11-29-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,345
vgersh99, with your solution I get this:


Code:
$ nawk 'BEGIN {FS=RS=""; ORS="\n\n\n"} $1=$1' file
          T h e   f i r s t   l i n e .
 S e c o n d   l i n e .


F i r s t   l i n e   o f   t h e   s e c o n d   p a r a g r a p h .
 S e c o n d   l i n e   o f   t h e   s e c o n d   p a r a g r a p h .

Set the record separators to 2 newlines:


Code:
$ awk 'BEGIN {RS=ORS="\n\n"} $1=$1' file
The first line. Second line.

First line of the second paragraph. Second line of the second paragraph.

Regards