inserting a blank line in a file 
Author Message
 inserting a blank line in a file

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:50:24 GMT  
 inserting a blank line in a file
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:45:43 GMT  
 inserting a blank line in a file

X Hi Colleagues,
X
X I want to insert a blank line in the very first line of the file. But,
X without deleting the line. In other words, the original first line is
X shifted downwards by inserting a blank
X line (at first line of the files).
X
X
X I am trying to do like this in awk.
X
X awk '(sub(/^$/, " "); print )'
X
X Is this correct?
X
X Thanks in advance for your help.
X
X best regards,
X rajan

    awk '
        BEGIN{ print }
        { print }
    ' input >output

or try

    (echo ""; cat input) >output

or

    echo "" >output
    cat input >>output



Fri, 11 Nov 2005 00:43:01 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. to insert a blank line

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

3. insert blank line

4. adding blank lines to text file

5. tell me how to read input from file with comments and blank line in it

6. How to read blank lines in a file?

7. blank line at top of file?

8. Detecting blank lines in text file read

9. Want to remove multiple occurances of blank line from a file

10. Reading a file containing blank lines

11. remove blank lines before lines beginning with string

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

 

 
Powered by phpBB® Forum Software