to insert a blank line 
Author Message
 to insert a blank line

Hi Colleagues,

I want to insert a blank line in the very first line of the file. But,
without deleting the line. In other words, the original first line is
shifted downwards by inserting a blank
line (at first line of the files).

I am trying to do like this in awk.

awk '(sub(/^$/, " "); print )'

Is this correct?

Thanks in advance for your help.

best regards,
rajan



Thu, 10 Nov 2005 18:53:55 GMT  
 to insert a blank line

Quote:

> Hi Colleagues,
> I want to insert a blank line in the very first line of the file. But,
> without deleting the line. In other words, the original first line is
> shifted downwards by inserting a blank
> line (at first line of the files).

Please stop multi-posting!

You don't need awk for this at all:

$ (echo;cat file) >> outfile

If you really want awk:

$ awk 'BEGIN{print}{print}' file > outfile

--
Michael Heiming

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM



Thu, 10 Nov 2005 22:48:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. inserting a blank line in a file

2. inserting blank lines (was Re: Preparing Excel spreadsheet forsearch engine)

3. insert blank line

4. remove blank lines before lines beginning with string

5. blank lines/lines with spaces (how to remove)

6. Fields blanking out when inserting new record

7. print inserts blanks - bug or feature?

8. adding blank lines to text file

9. print contents up to blank line

10. datafile has blank lines

11. Blank lines

12. Removing data between blank lines

 

 
Powered by phpBB® Forum Software