Insert a blank line at the start of a text file

I'd like to insert a blank line at the start of a text file.
I presume SED would be the best to use? Any help on code would be greatly appreciated?

Hi David,
   That is a little more difficult in sed and awk than it seems like it should be. I'll assume that you know how to handle the redirection and I'll just post the actual sed and awk commands. If you're comfortable with multiline statements in sed it could be done with the following:
sed '1s/./\
Programmatically more complicated but easier to type would be:
sed '1{x;p;g;}'
   I think that it's conceptually simpler in awk using the BEGIN address like so:
awk 'BEGIN{ print }//'
   You'll probably get other responses using other tools. I'm certainly curious to see what develops.
Gary
~~~~
   "And I don't like doing silly things (except on purpose)."
      -- Larry Wall in <[email protected]>

Similar Messages

  • Delete a line in the middle of a text file

    Hi, I want to delete a certain string line in the middle of a text file. How could I do this? Thanks.

    Got it. But instead of overwriting with spaces I only need to write the letter "b":
    try {
                                            RandomAccessFile acceso=new RandomAccessFile("F:/ArchivoContrase�as.txt","rw");
                                            String linea="";
                                            while ((linea = acceso.readLine()) != null) {
                                                      StringTokenizer patron=new StringTokenizer(linea," ;");
                                                      String s=patron.nextToken();
                                                      s=patron.nextToken();
                                                      if (elimina.equals(s)) {
                                                           System.out.println(acceso.getFilePointer());
                                                           acceso.seek(acceso.getFilePointer());
                                                           acceso.writeBytes("b");                         
                                       } catch (FileNotFoundException e) {
                                            e.printStackTrace();

  • SMS Messaging: Blank line at the end of the message

    I never had this problem with the 3G, but on my iPhone 4, I often see a blank line at the end of my text message after I send it.
    Also, a similar issue I am having is that while I am drafting text messages, the words fits nicely in the text input box, but once I hit send, some words are shifted to the next line.
    *Typed in input box:*
    Sorry. We'll be there asap.
    *Show in the green bubble:*
    Sorry. We'll be there
    asap.
    Anyone know how I can solve this problem? Thank you!

    this isnt the way to respond to someones problem... thats not what this forum is for ..
    now to the op have you tried resetting your phone by holding both the home button and the sleep/wake switch for 15 seconds...
    if that doesnt work I would try restoring your phone from backup to see if you can clear this issue up

  • How to insert blank lines in the ALV output.

    Hi Friends,
    Could any body help me out How to insert blank lines in the ALV output.?? Any Code pls...
    Thank you,
    Vikram.C

    hi vikram
    do like this
    In the fieldcatalog table all the fields should be in editable mode
    ie lw_fcat-edit = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    is_layout = lv_layout
    it_fieldcat = lt_fcat[]
    i_save = 'A'
    is_variant = lv_variant
    TABLES
    t_outtab = lt_license[]
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " display_data
    *& Form user_command
    FORM user_command USING r_ucomm TYPE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN 'ADD'. "
    data: lv_ind type i.
    data: lv_line type i.
    describe table lt_license lines lv_line.
    loop at lt_license into lw_license.
    lv_ind = sy-tabix.
    if lv_ind = lv_line.
    append initial line to lt_license.
    endif.
    endloop.
    ENDCASE.
    ENDFORM. "user_command
    reward points if useful
    Rohan

  • How can I remove the preceding blank lines in the downloaded text file?

    I have created a jsp that writes to a file and then prompts a dialog box to have an option to view or save the file. However when i view the file, there are blank lines before the actual content of the file. How can i remove these lines?
    Below is part of my code:
         response.setContentType("application/x-download");
         response.setHeader("Content-Disposition","attachment; filename=\""+ fileName + "\"");

    Hi,
    Those blank lines are normally because of the scriptlet code at the start of your jsp page.
    Remove any new lines between page directives or any include directives that you have at the top of your page.
    Look at the generated servlet code to see what exactly is causing the newline to be inserted (look for out.println("\n");)

  • Insert a blank line between records

    Hi,
    I am creating a sqlplus report and want to insert a blank line or some seperator to seperate the records between the start and end points of the loop to make it more readable.
    ex : The output currently look like this.
    ColumnA       ColumnB
    1                  2
    2                  3
    3                  1
    4                  5
    5                  6
    6                  4I want the output to look like this
    ColumnA       ColumnB
    1                  2
    2                  3
    3                  1
    4                  5
    5                  6
    6                  4Thanks for the help in advance!

    Hi,
    You probably work with this table every day, and you probably struggled with this particular query for a while before posting a question, so you're very familiar with the table, the data, and the application.
    Perhaps no one else in the world is in that position. Don't assume we know what your data is, or where it came from.
    Are you getting the data from a query like this?
    SELECT     columna
    ,     columnb
    FROM     table_x
    START WITH          columna     IN (1, 4)
    CONNECT BY NOCYCLE     columna     = PRIOR (columnb)
    ;If so, that's the kind of thing you should say clearly in your first message, rather than hint at in your third.
    As Ow said, you should manufacture a column for use in the BREAK command, and use COLUMN ... NOPRINT if you don't want to see it in the results?
    The question here is, what is an appropriate column? CONNECT_BY_ROOT seems to work perfectly for your example
    BREAK     ON my_break_column     SKIP 1
    COLUMN     my_break_column     NOPRINT
    SELECT     columna
    ,     columnb
    ,     CONNECT_BY_ROOT     columna     AS my_break_column
    FROM     table_x
    START WITH          columna     IN (1, 4)
    CONNECT BY NOCYCLE     columna     = PRIOR (columnb)
    ;The rest of this message is an merely a tangent. I find it interesting, but feel free to skip it.
    You might think CONNECT_BY_ISCYCLE was an obvious choice for a BREAK oclumn: you want to skip a line after every output row where CONNECT_BY_ISCYCLE = 1.
    Unfortunately, BREAK always works when a column value changes. That is, you can't tell it "Please skip one line after rows where columnz = 1"; all you can say is "Please skip a row before rows where columnz is different than it was on the previous row". (At least that's what I think: I would love it if someone proved me wrong!)
    So we have to manufacture some column that keeps its value for an entire loop. The SUM of CONNECT_BY_ISCYCLE (in DESCending order, as returned by the CONNECT BY query) would work. Analytic ORDER BY clauses seem to destroy the order imposed by CONNECT BY, so you'd have to do the CONNECT BY in a sub-query, capture the ROWNUM to preserve the order, and use the analytic SUM function in the main query:
    WITH     oq     AS
         SELECT     columna
         ,     columnb
         ,     ROWNUM               AS r_num
         ,     CONNECT_BY_ISCYCLE     AS cycle_val
         FROM     table_x
         START WITH          columna     IN (1, 4)
         CONNECT BY NOCYCLE     columna     = PRIOR (columnb)
    SELECT     columna
    ,     columnb
    ,     root
    ,     SUM (cycle_val) OVER (ORDER BY ROWNUM DESC)
    --               AS my_break_column
    FROM     oq
    ORDER BY     r_num
    ;The only reason for actually doing this is to learn about CONNECT BY queries. CONNECT_BY_ROOT, as shown above, works much better for your requirements.

  • Small square boxes appearing on blank lines (UPDATED) - The question is, how to get rid of them?

    *******  As to my display name "All I tried were in use" - when I registered at the Adobe site to use the Browser Lab, I tried something like 10 or 12 user names and finally gave up and went with "All I tried were in use" - my name is Bob
    ------------------------------- UPDATE --------------------
    The problem, small square boxes showing on lines in Freetext Tool comments, is not limited to blank lines, as I originally reported here. These boxes are showing up at the end of every line. It does not matter if the line break is hard or soft, whether the line is empty or not.
    Please read the original post bearing mind that the  problem is occurring at the end of all lines.
    Also - here is a screen capture of a part of one comment box, showing the square lines. I didn't show the entire box because the material above the area I'm showing is a tad private or confidential. Here is the image showing the boxes - note that there is no box at the end of the last line in the comment.
    -------- Original Post ------------
    We have a copy of Acrobat 5.0. and up until now it has done what we need, which is not much more than adding bookmarks, links, and some touch up. I know it is very old and I know things change. I'm hoping this has nothing to do with the release we are using. I would think this would be a backward compatibility issue if it is a problem with newer Reader versions dealing with PDFs "edited" with 5.0.
    I am having small square boxes showing up on blank lines. (read my update above  - the boxes are at the end of all lines, soft break or hard break))
    I'm a programmer (37+ years in most all aspects of Data Processing) and I decided to learn the PHP programming "language" to add some server side processing to some of my web sites. So, I found a fairly good manual on PHP in PDF form and have been using it.
    I quickly found that the PDF didn't have a single link in it and no bookmarks, so I've been adding them as I look up a particular subject. I'm also adding comments and notes to document things not in the original manual or to add comments that would help other programmers` (who know  other languages) to adjust to PHPs' way of thinking - for example: in all the other languages I know (perhaps two dozen) to get rid of a file, you "delete" it. In PHP you "unlink" it.
    I've added a lot of comments and notes like that and when I view the PDF in Reader (on this computer I have 9.4.2) I'm seeing small square boxes on empty lines. The lines were created when I pressed Enter twice to insert a blank line between paragraphs. (again, read the update at the top of this message - the boxes are at the end of all lines, soft break or hard break)
    How can I get rid of them?
    They are not present when I've got the PDF open with Acrobat, only when I'm using an Acrobat Reader.
    They are also not present if I look at the comments using the Comments navigation panel - that is, they still show on the page, but they don't show in the copy of the comment displayed in the navigation panel.
    They are not present in Notes or when I use one of the shape tools (Square Tool, Circle Tool, or Line Tool) to create notes. They are only present in Freetext Tool comments
    They are clearly being show where there are successive line feed/carriage return characters - but how do I get rid of them?
    I JUST THOUGHT OF SOMETHING - I realized that I'd not printed any of the pages on which I have placed comments and wondered if the boxes show when printing the PDF with Reader -- they do. They are not present if I use Acrobat, not a Reader, to print the same page.
    Any assistance you can provide will be greatly appreciated.
    Please don't tell me to get a newer version - an expenditure like that is simply and totally out of the picture. For us, this is a Depression, not a Recession - we are self-employed and our businesses have been severely hammered since 2006 - we are down to about 1/4 of our income before the big guys trashed the economy.
    Bob
    P.S. Do you know that you can have a heart attack without chest pain, shortness of breath, or left arm  pain? Well, you can! I've had two and the first one nearly killed me because I had no clue it was a heart attack. You can read about it first one here.  Pass this on, it could save a life.
    My second heart attack occurred on October 4, 20112 - it began, around 3:15 AM, as the first one did, with a headache. It turned out the stent implanted in 2002 had been completely clogged by too much tissue grown. The doctor put another stent inside the first one.

    Problem Resolved - it is a font issue. Apparently Acrobat can't handle particular fonts and it is best to stick with a very small slection of fonts - Arial, Helvetica, Times Roman.
    I haven't test a lot of fonts. If I do, I'll post there results here.
    Bob

  • How to get blank records at the start of report output for label sheet?

    Hello -
    What is the best way to get an arbitrary # of blank records at the start of report output?
    I am writing a report that will be printed out on label sheets -- some of which might already be used. For example, there might be 3 labels per page but the first 2 have been used the last time the report was run.. so the report needs to display 2 blank records first so that the first record that gets printed on a label is in the 3rd position on the page. (the user would indicate - through a parameter - what the starting postion would be)

    Hi Scott
    Create a user parameter that reads in the number of blanks you need to 'print' before starting the actual printing.
    In the Format trigger of the outermost frame of your report write code using SRW.SET_BEFORE_PRINTING_CODE.
    Loop this method based on the user parameter and call this method with skip-line-command of your printer as its argument.
    Regards
    Sripathy

  • TB 31.4 when compsing a message, has introduced a spurious blank line between the address boxes and subject box.

    When writing a new message I used to see two lines of address boxes followed by the subject line. So, when sending an email to a single recipient, that persons address would remain on screen as I composed the email.
    As of version 31.4 the initial "Write" window shows a single address line, the subject line, and a blank line between them. The consequence is that, upon entering the recipient's address, it immediately scrolls up and can no longer be seen. This happens regardless of how I enter the address i.e. start to type, select from address book and hit ENTER or TAB, or indeed if I choose an address from the address book sidebar. (See "capture1.png")
    If I increase the space available for the header data in the "Write" window I still get a blank line between the address lines and the subject line (see "capture2.png"). Furthermore, the next time I go to compose an email I am back with the original version of the "Write" window, as shown in "capture1.png".

    You might want to drop the author an email and let him know. It is not a major thing, but something that would probably require only a minor fix.
    I have found him helpful, but slow to reply. He is always on holidays when I email him.

  • Insert a blank line in a form

    Is there any way to insert a blank line into a form? The only thing I can think of is to insert an empty display as text item with no label.
    Is there an easier way?

    Hello,
    Playing with the cell height, in the HTML Table Cell Attributes – like style="height:50px" – and with the Horizontal / Vertical Alignment of the label and element, can produce whatever space you need between your form elements.
    Regards,
    Arie.
    Message was edited by:
    ageller1

  • GUI_DOWNLOAD blank lines in the middle

    Hi All,
    I am using 'GUI_DOWNLOAD' FM to create excel file of my internal table data; Internal table is having 220 fields and expects to create 220 columns in excel file;
    In the middle of the excel file I get several blank lines on and off with only very few column values are filled;
    I checked the ITAB in debug before calling the FM it has no issues and has the correct data;
    My code is as below;
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_filename
          filetype                = 'ASC'
          write_field_separator   = 'X'
        TABLES
          data_tab                = i_compare
          fieldnames              = i_excel_head
        EXCEPTIONS
          file_write_error        = 1
    Appreciate your expert ideas please;
    Thank you
    Iver

    Hi,
    GUI_DOWNLOAD blank lines in the middle
    In your GUI_DOWNLOAD code, There is no mistake.
    I think, In your program, have you written any SET BLANK LINES ON.
    It is one case.
    Follow this link,
    http://wiki.sdn.sap.com/wiki/display/ABAP/DownloadinginternaltablestoExcel
    It may helps to you.
    Regards,
    Sekhar

  • How to remove the blank lines at the end of the JTextArea .

    Hi,
    I need to remove the blank lines in the JTextArea at the end. Suppose i am giving 'A' in the first line and press the enter key two times, after i am giving the 'B' in the third line and press enter key for two times. I need to remove, the last two lines of JTextAreae, . How i can remove these lines?

    String#trim() removes all whitespace from both ends of the String.
    The requirement was to remove line breaks from the end of the String only.
    String#replaceAll with a suitable regex would do the trick. Untested regex for this:text.replaceAll("[\\n\\r]+$", "")db

  • Reporting Toolkit: How to insert a blank line into an MS Word Report?

    Hello,
    I have created an MS Word report, but I haven't been able to find out how to "write" a blank line to the report.  I've tried every combination of \n, \\n, "\n", '\n', \\n etc., but I haven't had any good luck.
    Thanks,
    Chris

    Hello,
    If you're using "append report".vi it's has one input for "new line".
    Message Edited by Jorge Amaral on 05-02-2008 03:28 PM
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL
    Attachments:
    append.PNG ‏3 KB

  • Blank line in the spool file

    Good day,
    I was trying to retrive data from the table and save the results in the spool file, but I find blank lines in the spool file. What can be the couses of that? I am using oracle 9i.
    regards
    Talifhani

    SET SHOWMODE off
    SET FEEDBACK OFF
    SET VERIFY off
    SET RECSEP off
    SET TRIMSPOOL on
    SET LINESIZE 20000
    SET HEADING OFF
    SET PAGESIZE 0
    SET PAGES 0
    ==>Select the spool file
    ==>Run you query
    ==>Spool off.
    Now check the spool file.
    Good luck!!!
    Bhagat

  • Insert a Blank Column in the Results Area of a Workbook

    Is it possible to insert a blank column in the results area of a WORKBOOK that does not get affected by free characteristic drill down or refreshing of the corresponding query?  The current workbook looks like follows
    Column A - Characteristic1
    Column B - Characteristic2
    Column C - KeyFigure1
    Column D - KeyFigure2
    Column E - KeyFigure3
    Column F - KeyFigure4
    The requirement is that the user wants to enter some estimates between Column B and Column C and Column D and Column E as follows
    Column A - Characteristic1
    Column B - Characteristic2
    Column C - USER ENTRY
    Column D - KeyFigure1
    Column E - KeyFigure2
    Column F - USER ENTRY
    Column G - KeyFigure3
    Column H - KeyFigure4
    Column I - CALCULATIONS BASED ON USER ENTRY
    First I tried to split the results area and save the workbook.  But when the query is refreshed then the entire results area gets back in one piece.  I succeeded partially by having a key figure with no possible output (i.e., restricting a non-existent value on a characteristic).  Again in here, whatever user inputs will get wiped out with the drill down.  Does any one have any pointers?  Thanks.
    IS

    Hi IS,
    As a nearly workaround I can suppose to do the following.
    Create two identical requests.
    In the first one hide the columns to the right from your intended new user column. In the second one - hide columns to left.
    Knowing the columns number to be shown in each request you can place both request in the same row, but in different columns taking into account that between result areas should be one (or more) additional column.
    Data entered by a user will not be wiped out during query refresh or drilldown. Of course, these user data will not conform drilldown operations. So, it is not 100% solution you want.
    Another possibility, very hard to implement (if feasible at all), is to write VB code that will monitor user action and will keep data entered by a user somewhere in another sheet and restore them in proper cells after user action (drilldown). But I don't think such coding worth it.   
    Best regards,
    Eugene

Maybe you are looking for

  • Mac Mini Computer Crashing

    Yesterday, I was kind of annoyed because my computer was running slower than usual, but it wasn't really getting in the way. Today, I logged out of an account on my mac mini, and I when I got to the login screen, the computer froze. So, I restarted t

  • RosettaNet ack error

    Hello All, We are on patch 7652646. We send a 3A4R to our TP. They send back the ack. However, the ack processing fails. The error we are getting is "_Document Exchange protocol name "RosettaNet" in message is different from document exchange protoco

  • How do I edit recently created PDF files?

    I Have created PDF files in Acrobat but I'm returning to make some changes but I'm unable to edit the documents. How do I edit PDF files on my ipad?

  • Intermittent error SSRS ReportViewer RemoteReport

    Hello, We are receiving intermittent time outs like the following:  Unable to connect to the remote server    at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)    at System.Web.Services.Protocols.HttpWebClientProto

  • Making this change would require changing code that is locked by a template of translator.

    Hello, I see a lot of the same questions. In my case however I use no templates or translators in my file. I use several included files, but they have no head or body tags inside of them. The message popped up when I tried to convert this file: The I