Skipping Blank Lines in text File

I am working on an assignment in which i have to read from a text file and store the strings individually. The problem i have is that the text file has blank line between each set of strings. So i figured to use "fin.nextLine();" to skip that blank line and continue with storing the values. but i get
"Exception in thread "main" java.util.NoSuchElementException: No line found
     at java.util.Scanner.nextLine(Unknown Source)
     at processmsg.ProcessMessages.choice1(ProcessMessages.java:68)
     at processmsg.ProcessMessages.main(ProcessMessages.java:25)"
which is where the fin.nexLine() is at. How can i just skip that blank line?
System.out.println("Please enter the file location");
          Scanner stdin = new Scanner(System.in);
          String fileName = stdin.nextLine();
          // read the information from the file
          try {
               Scanner fin = new Scanner(new File(fileName));
               String tSendName = fin.nextLine();
               while(tSendName != null)
                    String tRecieveName = fin.nextLine();
                    String tPhoneNumber = fin.nextLine();
                    String tDate = fin.nextLine();
                    String tTime = fin.nextLine();
                    String tStatus = fin.nextLine();
                    String tMessage = fin.nextLine();
                    PhoneMessage phonemessage = new PhoneMessage(tSendName, tRecieveName,
                              tPhoneNumber, tDate, tTime, tStatus, tMessage);
                    fin.nextLine();
                    tSendName = fin.nextLine();

don't know if you want the whole code, the whole code is kind of large and spread out over 3 different classes. and yes the text file is standard
sender
reciever
phone number
date
time
status
message
sender
reciever
phone number
date
time
status
message
sender
reciever
phone number
date
time
status
message
private static void choice()
          // scan the file location from the user
          System.out.println("Please enter the file location");
          Scanner stdin = new Scanner(System.in);
          String fileName = stdin.nextLine();
          // read the information from the file
          try {
               Scanner fin = new Scanner(new File(fileName));
               String tSendName = fin.nextLine();
               while(tSendName != null)
                    String tRecieveName = fin.next();
                    String tPhoneNumber = fin.next();
                    String tDate = fin.nextLine();
                    String tTime = fin.nextLine();
                    String tStatus = fin.nextLine();
                    String tMessage = fin.nextLine();
                    PhoneMessage phonemessage = new PhoneMessage(tSendName, tRecieveName,
                              tPhoneNumber, tDate, tTime, tStatus, tMessage);
                    // skip blank line between entries
                    fin.nextLine();
                    // test date string for correct format
                    int month = Integer.parseInt(tDate.substring(0,2));
                    int day = Integer.parseInt(tDate.substring(3,5));
                    int year = Integer.parseInt(tDate.substring(6,10));
                    // test time string for correct format
                    int hour = Integer.parseInt(tTime.substring(0,2));
                    int minute = Integer.parseInt(tTime.substring(3,5));
                    int second = Integer.parseInt(tTime.substring(6,8));
                    tSendName = fin.nextLine();
                    msgList.add(phonemessage);
               fin.close();
          } catch (FileNotFoundException e) {
               System.out.println("The file " + fileName + " was not found!");
          } catch (java.lang.NumberFormatException e) {
               System.out.println("The date and/or time is not of the correct format");
     }

Similar Messages

  • Blank line in text file after download

    Hi  all,
    i am using the below code to get the 254 blank spaces at the end of the text file & it's comming correctly.
    generally i am downloading 2 lines in the original program  & i am getting one blank line in between these two lines.
    The main thing is that i am getting this blank line when i run this program in my office computer. But i am not getting this blank line when i run this same program in my home laptop. Please suggest why this blank line is appearing & any solution ?
    DATA: BEGIN OF OUTTAB OCCURS 100,
            PROD_CODE(3),
            LINE_DETL(2043),
          END OF OUTTAB.
    DATA:V_OUTPUT(2043).
    DATA: space_character type c.
    space_character  = CL_ABAP_CHAR_UTILITIES=>MINCHAR.
            DO 254 times.
               CONCATENATE V_OUTPUT space_character INTO V_OUTPUT.
               ENDDO.
               OUTTAB-LINE_DETL = V_OUTPUT.APPEND OUTTAB.
    call function 'GUI_DOWNLOAD'
       EXPORTING
          filename = OUTFILE1
          filetype = 'ASC'
          TABLES
          data_tab = OUTTAB

    I don't think this is issue of ABAP. Any way just to check download the file on laptop and open same file and office computer
    if file looks ok then it is OS or text editor issue.
    Thanks,
    AK.

  • Ignore blank lines in text file using number format exception.

    hi.. does anyone know how to ignore a blank line and move on to the next line? the text file contains:
    2
    bla bla bla
    112.4
    222.5
    ble ble vle
    115.5
    123.2

    The problem with trim() is that it only trims spaces (0x20). In a source code file, "blank" lines are as likely to contain TABs as spaces. I would recommend something like   if (line.length() == 0 || line.matches("\\s+")) If the inefficiency of matches() becomes a problem, you can use a pre-compiled Pattern object, or roll your own isItWhitespace() method.

  • How copy just line in text file with cat? (SOLVED)

    Hi.
    How i make to copy just only line in text file with cat?
    For example:
    [:0.0]
    file=/home/Arch/./.wallpaper.png
    mode=0
    bgcolor=# 0 0 0
    I want copy just "/home/Arch/./.wallpaper.png" part.
    Actually i want create a shortcut for last wallpaper set from Nitroget, then i put this in SLim background.
    Recently i use hsetroot for wallpaper (~/.wallpaper.png) and i create a shortcut in /usr/share/slim/theme/MYTHEME whith ln -s ~/.wallpaper.png /usr/share/slim/theme/MYTHEME/background.png.
    I want make a same with Nitrogen.
    I now this looks like crazy, but...
    Sorry my English.
    Last edited by kramerxiita (2008-06-04 16:50:48)

    moljac024 wrote:
    kramerxiita wrote:
    moljac024 wrote:How can you make SliM change the background ? You link the theme background to another file ?
    Yes. In theme directory i put background.png shortcut for my wallpaper. So, when a change wallpaper, slim background change too.
    Example:
    ln -s mywallpaper.png /usr/share/slim/themes/default/background.png
    So, Slim background always is my wallpaper.
    So the wallpaper has to be a *.png ?
    No, jpg is possible. But when you create a symbolic link, remember put the extension too. If change png to jpg, change a symbolic link extension.
    But, remember if slim theme directory have background.png and background.jpg, Slim always choice .png. So, put only one this.

  • How to skip blank line in FCC

    Hi,
    How to deal with blank rows in FCC for fixed width file?
    I want to ignore these records as they will fail the message in mapping.
    thanks,
    Anirudh.

    Hi
    Look this thread might help u
    Blank line in receiver file adapter content conversion

  • How to write empty line in text file

    hey
    i want to insert one empty line in text file.
    how to write this.
    i declared
    data: emptyrec(240) type c value space,
    and used
    TRANSFER emptyrec to e_file.
    but its not inserting empty line in the record.
    is there any special way have to do.
    ambichan.

    hai anand,
    I am posting the code snippet.
    i have commented that transfer line in '----
    ' like this
    pls refer below.
    ambichan
    DATA: PAGENO(4) TYPE N VALUE 1,
          DATAKBN(2) TYPE N VALUE 1,
          SUBNO(3) TYPE N VALUE 1,
          VPAGENO(4) TYPE C,
          VDATAKBN(2) TYPE C,
          VSUBNO(3) TYPE C,
          VREC(255) TYPE C,
          VRECORD(255) TYPE C,
          EMPTYREC(255) TYPE C VALUE SPACE,
          VCODE(10) TYPE C,
          VNAME2(35) TYPE C,
          VPAYDAT(10) TYPE C,
          VSGTXT(60) TYPE C VALUE SPACE,
          VSGTXT1(10) TYPE C,
          VKINGAKU(15) TYPE C VALUE SPACE,
          VBIKKO(30) TYPE C VALUE SPACE,
          VBELNR(10) TYPE C VALUE SPACE,
          VDMBTR(15) TYPE C,
          VGLT0-KSLVT(15) TYPE C,
          VGLT0-TSL01(15) TYPE C,
          VGLT0-TSL02(15) TYPE C,
          VGLT0-TSL03(15) TYPE C,
          VGLT0-TSL04(15) TYPE C,
          VGLT0-TSL05(15) TYPE C,
          VKIN(15) TYPE C,
          VTEGA(15) TYPE C.
    FORM FRM_OUTPUT_DATA.
      SORT ITAB_OUTPUT_SUMMARY BY LIFNR DTYPE.
      SORT ITAB_OUTPUT_ITEMS   BY LIFNR DTYPE BELNR.
    IF P_DISP = 'X'."checkボクスを選ぶ場合、ファイル作成処理へ行く
    OPEN DATASET E_FILE FOR OUTPUT IN TEXT MODE.
      IF SY-SUBRC <> 0.
      WRITE: 'error',SY-SUBRC.
      EXIT.
      ENDIF.
    LOOP AT ITAB_LIFNR.
      PERFORM LISTDATA.
      PAGENO = PAGENO + 1.
      SUBNO = 1.
    ENDLOOP.
    CLOSE DATASET E_FILE."&#12501;&#12449;&#12452;&#12523;&#12463;&#12525;&#12540;&#12474;
    ENDFORM.                               " End of frm_output_data
    FORM LISTDATA.
      DATA:
        WK_PAY_AMOUNT  LIKE  BSEG-DMBTR,   " &#32020;&#25903;&#25173;&#38989;&#31639;&#20986;&#29992;
        VWK_PAY_AMOUNT(15) TYPE C,
        GLT0-TSL05_VAL LIKE GLT0-TSL05.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 1.
    BSIK-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      GLT0-TSL01  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 2. " &#21306;&#20998;&#65306;2
      GLT0-TSL02  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 3. " &#21306;&#20998;&#65306;3
      GLT0-TSL03  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 4. " &#21306;&#20998;&#65306;4
      GLT0-TSL04  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 5. " &#21306;&#20998;&#65306;5
      GLT0-TSL05  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
    glt0-tsl05  =  glt0-tsl05  +  glt0-tsl04.
      WK_PAY_AMOUNT  =  GLT0-TSL05  +  GLT0-TSL04.
    CHECK WK_SUBRC = 0.                
      BSEG-KOART = ' '.                    &#24773;&#22577;&#19981;&#35201;
      CLEAR: BSEG-SGTXT, BSEG-DMBTR, TGSBT-GTEXT, BKPF-BELNR.
      BSEG-KOART = 'Y'.                    " &#12501;&#12521;&#12464;&#65306;&#12504;&#12483;&#12480;&#12395;&#30456;&#27578;&#38989;&#12434;&#20986;&#21147;
    CLEAR: BSAK-DMBTR.
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 6.  " &#21306;&#20998;&#65306;6
      BSAK-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSAK-DMBTR.
      WRITE : / PAGENO,
               SUBNO,
               DATAKBN,
               ITAB_LIFNR-LIFNR,
               ITAB_LIFNR-NAME2(25),
               P_PAY_T,
               GLT0-TSL01,
               GLT0-TSL02,
               GLT0-TSL03,
               GLT0-TSL04,
               GLT0-TSL05.
    VPAGENO = PAGENO.
    VSUBNO = SUBNO.
    DATAKBN = 1.
    VDATAKBN = DATAKBN.
    VCODE = ITAB_LIFNR-LIFNR.
    VNAME2 = ITAB_LIFNR-NAME2.
    VPAYDAT = P_PAY_T.
    VGLT0-TSL01 = GLT0-TSL01.
    VGLT0-TSL02 = GLT0-TSL02.
    VGLT0-TSL03 = GLT0-TSL03.
    VGLT0-TSL04 = GLT0-TSL04.
    VGLT0-TSL05 = GLT0-TSL05.
    CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT VKINGAKU
    VBIKKO VBELNR VGLT0-TSL01 VGLT0-TSL02 VGLT0-TSL03
    VGLT0-TSL04 VGLT0-TSL05 INTO VREC SEPARATED BY ','.
    CLEAR: BSAK-DMBTR, BSID-DMBTR, BSAD-DMBTR, BSEG-DMBTR, BSIK-DMBTR,
             WK_10 , WK_11 , GLT0-TSL05.
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 7.  " &#21306;&#20998;&#65306;7
      BSID-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSID-DMBTR.
    &#37109;&#36865;&#26009;&#12398;&#20986;&#21147;&#20966;&#29702;
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 8.  " &#21306;&#20998;&#65306;8
      BSAD-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSAD-DMBTR.
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 9.  " &#21306;&#20998;&#65306;9
      BSEG-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSEG-DMBTR.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 10.
      WK_10 =     ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 11.
      WK_11 =     ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      GLT0-TSL05  =   WK_PAY_AMOUNT - WK_10 - WK_11.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  GLT0-TSL05.
       VWK_PAY_AMOUNT = WK_PAY_AMOUNT.
       VKIN = WK_10.
       VTEGA = WK_11.
       CONCATENATE VREC VWK_PAY_AMOUNT VKIN VTEGA INTO
             VRECORD SEPARATED BY ','.
       TRANSFER VRECORD TO E_FILE.
        WRITE :
                VWK_PAY_AMOUNT,
                WK_10,
                WK_11.
       WRITE:/.
      BSEG-KOART  = 'X'.                   " &#12501;&#12521;&#12464;&#65306;&#35531;&#27714;&#37329;&#38989;&#12434;&#20986;&#21147;
      LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
                                AND   DTYPE = 5.          " &#21306;&#20998;&#65306;5
        BSEG-SGTXT   =  ITAB_OUTPUT_ITEMS-SGTXT.          " &#26126;&#32048;&#12486;&#12461;&#12473;&#12488;
        GLT0-KSLVT   =  ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO.     " &#37329;&#38989;
        TGSBT-GTEXT  =  ITAB_OUTPUT_ITEMS-GTEXT.              BKPF-BELNR   =  ITAB_OUTPUT_ITEMS-BELNR.         
       SUBNO = SUBNO + 1.
       VSUBNO = SUBNO.
       DATAKBN = 2.
       VDATAKBN = DATAKBN.
       VGLT0-KSLVT = GLT0-KSLVT.
       VBIKKO = TGSBT-GTEXT.
       VBELNR = BKPF-BELNR.
       VSGTXT1 ='&#35531;&#27714;&#37329;&#38989;:'.
       CLEAR VRECORD.
      CONCATENATE  VSGTXT1 BSEG-SGTXT INTO VSGTXT.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
    VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
       WRITE :/ VPAGENO,VSUBNO,VDATAKBN,'&#35531;&#27714;&#37329;&#38989;:', VSGTXT, VGLT0-KSLVT,
                VBIKKO,VBELNR.
      ENDLOOP.
      CLEAR: BSEG-SGTXT,GLT0-KSLVT,BKPF-BELNR.
    LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
                                AND   DTYPE = 6.          " &#21306;&#20998;&#65306;6
        BSEG-SGTXT   =  ITAB_OUTPUT_ITEMS-SGTXT.          " &#26126;&#32048;&#12486;&#12461;&#12473;&#12488;
        IF  ITAB_OUTPUT_ITEMS-SHKZG  =  CNS_CREDIT.       " &#37329;&#38989;
          GLT0-KSLVT  =  ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO.
        ELSEIF  ITAB_OUTPUT_ITEMS-SHKZG  =  CNS_DEBIT.
          GLT0-KSLVT  =  ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO * -1.
        ENDIF.
      TGSBT-GTEXT  =  ITAB_OUTPUT_ITEMS-GTEXT.          " &#20107;&#26989;&#38936;&#22495;&#12486;&#12461;&#12473;&#12488;
      BKPF-BELNR   =  ITAB_OUTPUT_ITEMS-BELNR.          " &#20253;&#31080;&#30058;&#21495;
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      DATAKBN = 3.
      VDATAKBN = DATAKBN.
      VGLT0-KSLVT = GLT0-KSLVT.
      VBIKKO = TGSBT-GTEXT.
      VBELNR = BKPF-BELNR.
      VSGTXT1 ='&#30456;&#27578;&#37329;&#38989;:'.
      CLEAR VRECORD.
      CONCATENATE  VSGTXT1 BSEG-SGTXT INTO VSGTXT.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
    concatenate vpageno vsubno vdatakbn
      WRITE :/ PAGENO,SUBNO,DATAKBN,'&#30456;&#27578;&#37329;&#38989;',BSEG-SGTXT, GLT0-KSLVT,
             TGSBT-GTEXT, BKPF-BELNR.
      ENDLOOP.
       CLEAR VRECORD.
    *Insert empty line.
      TRANSFER EMPTYREC TO E_FILE.
      DATAKBN = 3.
      VDATAKBN = DATAKBN.
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT ='&#28304;&#27849;&#37329;&#38989;'.
      VDMBTR = BSID-DMBTR.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      WRITE :/ PAGENO, SUBNO,DATAKBN, ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
             P_PAY_T,'&#28304;&#27849;&#37329;&#38989;', BSID-DMBTR.
      CLEAR: VDMBTR, VSGTXT, VRECORD.
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT = '&#37109;&#36865;&#26009;'.
      VDMBTR = BSAD-DMBTR.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      WRITE :/ PAGENO, SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
             P_PAY_T,'&#37109;&#36865;&#26009;', BSAD-DMBTR.
      CLEAR: VDMBTR, VSGTXT, VRECORD.
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT = '&#25391;&#36796;&#12415;&#25163;&#25968;&#26009;'.
      VDMBTR = BSEG-DMBTR.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      CLEAR: VDMBTR, VSGTXT, VRECORD.
      WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
            P_PAY_T,'&#25391;&#36796;&#12415;&#25163;&#25968;&#26009;',BSEG-DMBTR.
    *&#12381;&#12398;&#20182;&#12398;&#25903;&#25173;&#12356;&#12398;&#20966;&#29702;
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT = '&#12381;&#12398;&#20182;&#12398;&#25903;&#25173;&#12356;'.
      VDMBTR = GLT0-TSL05.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
            P_PAY_T, '&#12381;&#12398;&#20182;&#12398;&#25903;&#25173;&#12356;',GLT0-TSL05.
                                     glt0-tsl05.
    ULINE.
    CLEAR: VREC, VRECORD,VCODE,VNAME2,VPAYDAT,VSGTXT,VSGTXT1,VKINGAKU.
    CLEAR: VBIKKO,VBELNR,VDMBTR,VGLT0-KSLVT,VGLT0-TSL01,VGLT0-TSL02.
    CLEAR: VGLT0-TSL03,VGLT0-TSL04,VGLT0-TSL05,VKIN,VTEGA,VWK_PAY_AMOUNT.
    ENDFORM.

  • Blank lines in Export files

    Hello,                                                                               
    When we export in BPC version 7 there are blank lines in the file. This gets in the way when we automate the export and import into another system since it picks up blank lines as the end of file. Do you know why this is happening and how we can remove them on the export automatically so they do not show up? 
    Many thanks in advance.
    Regards,
    Poonam

    Hi All,
    While extracting data from any application or making any selections to extract, the same thing is happening while exporting. This is happening with multiheader excel format.
    Yes, i am trying to extract data using the transformation file and running the export package.
    Would request you guide me further.
    Regards,
    Poonam

  • Read lines from text file to java prog

    how can I read lines from input file to java prog ?
    I need to read from input text file, line after line
    10x !

    If you search in THIS forum with e.g. read lines from file, you will find answers like this one:
    Hi ! This is the answer for your query. This program prints as the output itself reading line by line.......
    import java.io.*;
    public class readfromfile
    public static void main(String a[])
    if you search in THIS forum, with e.g. read lines from text file
    try{
    BufferedReader br = new BufferedReader(new FileReader(new File("readfromfile.java")));
    while(br.readLine() != null)
    System.out.println(" line read :"+br.readLine());
    }catch(Exception e)
    e.printStackTrace();
    }

  • How to skip blank line (EOF char) at the end of the file while creating ?

    Hi,
    In my program I have to create a file in Text mode using OPEN DATASET statement. This file is being sent to a third party system for their processing. I came to know while creating the file using OPEN DATASET, one LF character is inserted end of the file resulting a blank line end of the file. Thus if my internal table contains 5 reocrds, in the created text file I can see 6 lines where last is a blank. My question is how to remove this blank line which is causing issue in the thirdparty system.
    Here is the Code I have used.
       TRY.
    Write the file in Text Mode
            OPEN DATASET lv_outpf FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE
                                 WITH SMART LINEFEED
                                  MESSAGE lv_msg.
            IF lv_msg IS NOT INITIAL.
              WRITE / lv_msg.
              EXIT.
            ENDIF.
            LOOP AT itab_new INTO st.
              TRANSFER st TO lv_outpf.
            ENDLOOP.
            CLOSE DATASET   lv_outpf.
          CATCH cx_root.                                    "#EC No Handler
        ENDTRY.

    an effective way to do it:
    open your dataset in binary mode, transfer the records but between each record transfer the LF (or CRLF according to your need)
    after the last record you don't transfer the LF

  • Acrobat Pro 9, blank lines in text boxes vanish upon save

    Folks,
    Since I upgraded from Acrobat Pro 8 to 9, whenever I put blank lines in a text box, the blank lines disappear as soon as the PDF is saved.
    Here's an example:
    - Open a PDF file
    - Click on text box tool in the toolbar (or from menu Comments->Comments and markup Tool->Text box tool
    - Draw a box on the PDF page somewhere
    - Enter "First line", then hit Return twice to add a blank line below, enter "Second line"
    - Right now my text box contains two lines of text separated by a blank line
    - Hit save
    - Blank line vanishes in the text box. Now the two text lines are on adjacent rows.
    This did not happen in either Acrobat Pro 7 or 8. I've been using textboxes consistently for years without this silly behavior.
    Any suggestions? I've looked through forums and knowledge bases and such to no avail.
    I have acrobat pro version 9.0.0 running on XPSP3.
    Thanks!
    Petros

    Hello Petros,
    I figured out how to make this work, at least on my computer.  Hold CTRL key and hit ENTER.  This leaves the space.  Hope this works for you.
    Phillip

  • Count lines in text file

    Folks:
    What's the best way to count the number of lines in a text file?
    thanks,
    Kevin

    You can also skip the open/create, you'll still get a file dialog. I guess EOL conversion is also not needed.
    So the most minumalistic code is as follows.
    Has anyone done any benchmarks? Somehow I have the feeling that temporarily creating that big array of strings might not be the most efficient compared to reading all as one string and counting linefeeds. Who knows...? How big are your files?
    Message Edited by altenbach on 09-29-2006 04:03 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CountLines.png ‏1 KB

  • Finding the number of Non-Blank Line in a File

    Does anyone know the command or how to find the number of non-blank lines in a text file? I have the program already reading characters, words, and total lines.
              BufferedReader FileIn = new BufferedReader( new FileReader( selectedFile ) );
                   Scanner scanWords = new Scanner (selectedFile);
                             String thisToken = "";
                             int numWords = 0;
                             while (scanWords.hasNext())
                             thisToken = scanWords.next();
                             numWords++;
         System.out.println("Total number of words: " + numWords);
         Scanner scanLines = new Scanner (selectedFile).useDelimiter("\n");
                             String thisToken2 = "";
                             int numLines = 0;
                             while (scanLines.hasNext())
                             thisToken2 = scanLines.next();
                             numLines++;
         System.out.println("Total number of lines: " + numLines);
         Scanner scanChars = new Scanner (selectedFile).useDelimiter("");
                             String thisToken3 = "";
                             int numChars = 0;
                             while (scanChars.hasNext())
                             thisToken2 = scanChars.next();
                             numChars++;
         System.out.println("Total number of characters: " + numChars);
                   FileIn.close();
              }

    Use BufferedReader#readLine() instead. Read the file once and process each line once.

  • Output skips few line item texts

    Hi All,
    In smartform output for purchase order it displays line item and their text in main window.
    For some PO's it works fine and for some it skips few lines of some line item text.
    In debugging i could find all line items populated.
    Steps Taken:
    1) In table defination i checked no page-break. Problem is it works fine but the first page comes blank and rest is fine.
    Is there any way to resolve this?
    Thanks,
    M Mishra

    Hi All,
    In smartform output for purchase order it displays line item and their text in main window.
    For some PO's it works fine and for some it skips few lines of some line item text.
    In debugging i could find all line items populated.
    Steps Taken:
    1) In table defination i checked no page-break. Problem is it works fine but the first page comes blank and rest is fine.
    Is there any way to resolve this?
    Thanks,
    M Mishra

  • How to adjust splitted lines into one line in Text file?

    Hi Guys,
    I have a text file with 3 fields(comma separated): GLCode (Number), Desc1 (Char), Desc2(Char) and need to load it into BW.
    My Text file looks like:
    1011.00,"Mejor PC Infrastructure","This line is ok."
    1012.00,"Telephone Equipment $","This line ends in next line.   
    1)Need to change the equipment immediately.
    2)Take immediate action"
    1013.00,"V1 Computer Server Infrastructure # Equip","For purchases
    of components that make up the company's network, such as servers, hubs, routers etc."
    1014.00,"Flash Drive","Need to provide all IT Developer"
    This is how file looks like. Now I need the followings:
    1. Need to remove the space and need to adjust the splitted line into one. Say here
    line/record 2 is splitted into 3 lines and need to adjust in 1 line.
    2. In Line 5 (Record 3) data splitted into 2 lines and need to make 1 line.
    3. Need to remove bad characters.
    Could someone help me please how to proceed ?
    Regards,

    Not quite correct by my testing.  Try:
    $i=0
    Get-Content .\test.txt | ForEach {
    If ($i%2){
    ("$Keep $($_)").Trim()
    }Else{
    $keep=$_
    }$i++
    Good catch!
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • Find and edit specific line in text file?

    Hello I want to read a text file that could look in some different ways since the user choose file from a list. I then want to igonre all the lines that begin with a special character, for example %. I then want to find all the lines "words" that begin with TRY for example and put those "words" in a string or array. If there is one line that contains TRY100 and anoter line that contains TRY200 I want to find those words and display them. How do i do this?

    First you read the entire file.  Use the Read Text File.  Right-click on it and select the option to Read Lines.  The the count to read to -1 (read all).  You will now have an array of strings, one item for each line of your file.
    Now you need to play the filter game.  I recommend using FOR loops with Autoindexing tunnels.  Assuming you are using 2012 or later, have the output autoindexing tunnels use the conditional tunnel.
    Give this a try and see where you can go.  Post back with what you have tried and tell us where you are stuck.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • Problem with iChat changing my custom away message after 30 minutes

    Lately, I've been having a big problem with iChat changing any custom away message that I put up to "Away" after 30 minutes or so. Is there anything I can do to make it stop? Another issue I'm having is that sometimes when people on my buddy list cha

  • Error occurs when not logged in as admin

    I have service pack 3 installed which includes 1&2. I think my error is more in depth. We cannot give all users power user access either.

  • Error in transaction SOST

    Hi All, In transaction SOST, there are a lot of entries with the message "Email IHC account statements not delivered". For certain other entries the status text shows "The message could not be processed in the SAP system". What could be the reason fo

  • How to establish WS Security for BPEL processes running on Web Logic

    We are running SOA Suite 10.1.3.4 on Web Logic Server 9.2. I have built BPEL processes and now want to implement WS Security for them, "Wssp1.2-Wss1.0-UsernameToken-Plain-X509-Basic256.xml" in particular. Have been researching but could not find any

  • Error code A12E6 in Application Manager

    What does the error code A12E6 mean in Adobe Application Manager, came up when loading program.