Searching through text file

Hi guys,
I want to search for a string in a file then copy everything after it into a string array i guess, basically the requirement is that where i work we get letters they are usually a paragraph long what i want to do is just just copy those paragraphs into a variable and save them to a database with the date and time. if i can be pointed towards the write API or a sample code that would be highly appreciated.
Thank you in advance.
regards
zeeshan

Say your paragraphs are seperated by a empty line (\n)
import java.io.*;
public class New{
  public static void main(String args[]){
    try{
      new New().getParagraphs(args[0],args[1]);
    }catch(Exception ex){
      ex.printStackTrace();
  public String[] getParagraphs(String after, String fileName) throws Exception{
    File file = new File(fileName);
    if(!file.exists())
      throw new Exception("File not Found");
    else{
      BufferedReader br = new BufferedReader(new FileReader(file));
      String fileData = "";
      String temp = null;
      boolean canCopy = false;
      while((temp = br.readLine()) != null)
        if(canCopy)
          fileData += temp + "\n";
        else
          if(temp.indexOf(after) != -1){
            canCopy = true;
            fileData += temp.substring(temp.indexOf(after) + after.length()) + "\n";
    return fileData.split("\n");
}Edited by: gtRpr on 2008/06/26 01:36

Similar Messages

  • Looking for a free iOS 4 app that can search through .pdf files or spreadsheets

    Looking for a free iOS 4 app that can search through .pdf files or spreadsheet    
    Thanks

    Hey there
    "pdf creator" for iPad works flawlessly for me working with pdf files
    It takes care of all my needs
    I'm not sure about sending via Wifi or Bluetooth but I send them via e- mail all the time
    Possibly it could handle your needs as well
    Just type it into the App Store search field and the first one that comes up is the one I use
    Jump on over there and read up on it before buying and see if it will help you 
    Hope this helps
    Regards

  • Is there a function to Search a Text File?

    I am writing a program that will read data from a URL and then save that URL to a text file. I then need to be able to search the text file for certain strings and must know which line they appear on. I realize that I could read the text file in line by line looking for the string and then note the current line number. However, I need to search for 20-30 different strings in each URL and this would be very inefficient. I would really like some way to say:
    int lineNumber = 0;
    lineNumber = searchText("sometextfile.txt", str);
    And have searchText return the lineNumber on which the String str was found. Alternately, if there is way to search a URL that would cut out the middle man of writing it to a text file first.
    Any help would be greatly appreciated as I could not find this anywhere. Thanks.

    I have done something similar to to this, but it depends on what you want to use it for. I was looking for specific data on websites and would copy that data into a database. So, I used regex to find the data on the site and copy it. I also had to use String Tokenizer in certain places to get the correct data sometimes.
    orozcom

  • Searching a text file and printing the line if found!

    Hi, Im fairly new to JAVA and have been googling this for hours and havent found any results that
    have helped me...
    Im looking to search a text file for a value that is in a that is delimited by colons
    eg 45787 : 398948 : 398884 : 398984
    IF that value is found I need to print this entire line and move it into a string.
    I can work out the delimit part, the problem for me is a)searching the text file
    and b) tell java to print that line only??
    Any help would be very very much appreciated
    Cheers
    James

      public void printCourses() throws Exception
                stuinput[] courseObjArray = new stuinput[10]; //Make sure this is the same as the ammount in the text
                   Scanner sc = new Scanner(new File("testfile.txt"));
                   int i=0;
                   boolean found = false;
                   while(sc.hasNextLine())
                   //Delimit this line with scanner
                   Scanner sc1 = new Scanner(sc.nextLine());
                   sc1.useDelimiter(":");
                   courseObjArray[i] = new stuinput(sc1.next(),sc1.next());
                   i++;
                   }//while
                   for(int i1 = 0;i1 < courseObjArray.length;i1++)
                   System.out.println(courseObjArray[i1].courseCode);
                   System.out.println(courseObjArray[i1].courseName);
                   System.out.println(courseObjArray[i1].courseName);
                   System.out.println("-----------------");     
                   String courseCode2 = "courseObjArray[i1].courseCode";
                   if (courseCode2  == "12345")
                        System.out.println("working");
                   else{System.out.println("Not Found");}
           }hmmm just wondering why could this method always return a "Not Found"....if the text file had a whole bunch of values like this
    12345:Course1
    12344:Course2
    12343:Course3
    isnt it surposed to return 1 "Working"?? because there is a 12345 in on of the line, in the semi colon delimited line with 2 values, one being the course code, one being the course name??
    Given that there is 10 lines (from Array Object)

  • Searching through .fla files

    Usually when I am looking for a specific field name, section of code or variable, I will run a GREP regex search to search through my ASP files, which works great as they are just stored as plain text, however I was wondering if anyone knows of a way to do the same with ".fla" files.
    The GREP search looks through all my files in one go and returns a list of files which match the search terms; but wouldn't work on .fla files as the actionscript is not stored as plain text. Possibly this would work if I converted all my ".fla"s to use seperate ".as" files but this would be a lot of work and I'd rather avoid it if possible.
    Thanks for any help you can give.

    Select the stage window, then select Search and Replace from the Edit menu. This search tool works pretty well. If you search when an Actionscript window is selected you will only be able to search that one frame of AS.

  • Search the text file using vbscript.

    Hi I have some data in my text file. Below is the content. Now I need to search the file whether it contains identityType as ApplicationPoolIdentity. Any help in vbscript???
     name:"example"
     queueLength:"1000"
     autoStart:"true"
     enable32BitAppOnWin64:"false"
     managedRuntimeVersion:"v2.0"
     managedRuntimeLoader:"webengine4.dll"
     enableConfigurationOverride:"true"
     managedPipelineMode:"Integrated"
     CLRConfigFile:""
     passAnonymousToken:"true"
     startMode:"OnDemand"
     [processModel]
       identityType:"ApplicationPoolIdentity"
       userName:""
       password:""
       loadUserProfile:"false"

    ok my solution is below,
    CONST ForReading = 1
    Dim File1
    Dim FileToRead
    Dim strLine
    Dim infoResult
    Dim strDir, objFile, returnvalue
    strDir = "C:\Scripts\"
    File1 = "sample.txt"
    FileToRead = strDir & File1
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(FileToRead, ForReading)
    Do Until objFile.AtEndOfStream
        strLine = objFile.ReadLine
            if instr(strLine, "identityType") <> 0 then
              if instr(strLine, "LocalSystem") <> 0 then
                    infoResult = "Found"
                    exit do
                end if
            else
                infoResult = "Not Found"
            end if
    Loop
    objFile.Close
     Wscript.Echo infoResult    
    Set objFSO = Nothing
    Set objFile = Nothing

  • Binary search in text files

    Hi all,
    I'm thinking about how to implement a binary sort to get,given a key, a value from a text file with a list of words in order. I saw randomaccessfile for j2se and I know that this work it's usually done by seek functions but how to do the seek work without the File class , with only the InputStream and Reader? I'm talking about the j2me midp 2 cldc 1.1 api, is there some methods or class to use for this thing? How could be implemented a binary search in a text file resident in the /res dir or the JAR or which could be the problems that cannot make possible this staff? If there was something like seek one way could be that one of decide a common length of words to read so going to the half of the text file it's possible with simply multiplication, and the do the binary search things.But for now I haven't found any resources or help.
    I hope you can help me to understand, thank you

    Hallo all,
    it is NOT the problem to locate the text I need to find in the fmb, or fmx.
    The problem is that since I want to change not only the text but also some more code around I want to do this in Form Builder - Object Navigator. And I'm not able to discover in which trigger or procedure the text appears.
    I do not want to edit fmx, or fmb in a text editor because I suupose theer are some checksums hidden for the format.
    -duro
    BTW in FMT there is no code seen (only some binary) for v6i as it was in v4.5.

  • Scrolling through text file records issue?

    Hi there
    I am having an issue when trying to scroll though my saved contacts.
    On boot up they all work fine, and each record goes in its corresponding textfield. Now I cannot scroll left and right through the records, to display each new record.
    I tried making a marker at the end of each set, by putting a -1, -2 and so on per record, to distinguish the end of a record set. With the below however when I click right, and it just puts a -1 in the textfield??
    How do I get the program to distinguish the difference between the end of a record and the details of a new one?
    //This code is used at start up to read in the first record. This works fine.
    public TabbedPaneDemo()
    //BufferedReader br = null;
    BufferedReader no = null;
    Count = 0;
    try
    br = new BufferedReader(new InputStreamReader(new FileInputStream("\\c:\\filename.txt")));
    String s = "";
    while((s=br.readLine()) != null )
    Count = 1;
    //System.out.println("Data is " + s);
    inboundtext = s;
    if ( Count == 1 )
    //fdTitle.setText(inboundtext);
    fdTitle.setText(inboundtext);
    break;
    while((s=br.readLine()) != null )
    //System.out.println("Data is " + s);
    inboundtext = s;
    Count = 2;
    if ( Count == 2 )
    //fdTitle.setText(inboundtext);
    fdFirst.setText(inboundtext);
    break;
    //--------and so on tfor the rest
    //The code here is the problem. This is the button to scroll right through the records.
    else if (evt.getSource() == pane_butRIGHT)
    System.out.println("RIGHT");
    Aniversary = fdAniversary.getText();
    int test = Integer.parseInt(Aniversary);
    int setter = 4;
    try
    br = new BufferedReader(new InputStreamReader(new FileInputStream("\\c:\\filename.txt")));
    String s = "";
    while((s=br.readLine()) != null )
    Count = 1;
    inboundtext = s;
    //System.out.println(s);
    if ( inboundtext.equals("-1"))
    System.out.println("positive");
    //continue ;
    while((s=br.readLine()) != null )
    fdTitle.setText(inboundtext);
    fdFirst.setText(inboundtext);
    //break;
    catch(IOException ie)
    finally
    try
    if(br!=null) br.close();
    catch(Exception e)
    /* my text file I'm reading from below */
    mr
    lee
    smithers
    smith
    chappy
    [email protected]
    1 d road
    delta rd
    surrey
    kt4
    uk
    ww.vw.com
    337
    5791
    0781
    arm
    110 fb road
    cambs
    cambs
    cb1
    UK
    arm.com
    3rd line
    sysadmin
    410
    00
    00
    1
    2
    3
    4
    -1
    dr
    bob
    b
    bun
    cob
    [email protected]
    main st
    hamp
    ny
    14457
    ussa
    arse.com
    44
    00
    66
    piano inc
    main st
    rubbish
    5749
    duff
    usa
    abc.com
    yoyo
    billies
    desk
    222
    111
    00
    3
    69
    8
    7
    -2

    Hi camickr
    thanks for the responce,
    I understand what you saying with the stringtokenizer.
    However my text file would have loads of rows of contacts. My problem comes in where when I want to scroll through those rows, I need them to be display on my GUI which has a Jtextfield per contact detail type, IE one for name and another surname and so on.
    Now when the program loads, it reads in the first contact set fine. If I want to read the second contact set, I am stuck. Same again applies if I want to scroll back throgh the contacts? How do I do this?
    As you can see in the default constructor, there is a whole batch of while loops getting text initally for the JTextfields. If I could change this just to read the second through in and so on when hitting left or right, problem solved.
    thanks
    Whole program below:
    import javax.swing.JFrame;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.geom.*;
    import java.awt.Graphics.*;
    import java.awt.Color.*;
    import javax.swing.JPanel.*;
    import javax.swing.JLabel;
    import java.awt.event.*;
    import javax.swing.text.html.*;
    import java.net.*;
    import java.net.URL.*;
    import java.io.IOException;
    import java.io.*;
    import java.awt.image.*;
    import javax.swing.border.*;
    import java.applet.*;
    import javax.swing.JEditorPane;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.tree.TreeSelectionModel;
    import javax.swing.JTabbedPane;
    import javax.swing.ImageIcon;
    import java.util.StringTokenizer;
    public class TabbedPaneDemo extends JPanel implements ActionListener
         JButton pane_butSave = new JButton();
    private JLabel lblTitle = new JLabel("tilte:" );
    private JLabel lblFirst = new JLabel("first:" );
    private JLabel lblMiddle = new JLabel("Middle:");
    private JLabel lblLast = new JLabel("Last:" );
    private JLabel lblNickName= new JLabel("nick name:" );
    private JLabel lblEmail= new JLabel("e-mail:" );
    private JTextField fdTitle = new JTextField(4);
    private JTextField fdFirst= new JTextField(15);
    private JTextField fdMiddle = new JTextField(15);
    private JTextField fdLast = new JTextField(20);
    private JTextField fdNickName = new JTextField(15);
    private JTextField fdEmail = new JTextField(50);
    private JLabel lblStreetAddress = new JLabel("Street Address");
    private JLabel lblCity = new JLabel("Town");
    private JLabel lblCounty = new JLabel("County");
    private JLabel lblCountry = new JLabel("Country");
    private JLabel lblPostCode = new JLabel("ZIP/Post");
    private JLabel lblWebpage = new JLabel("Web Page");
    private JLabel lblPhone = new JLabel("Phone");
    private JLabel lblFax = new JLabel("Fax");
    private JLabel lblMobile = new JLabel("Mobile");
    private JTextField fdStreetAddress = new JTextField();
    private JTextField fdCity = new JTextField ();
    private JTextField fdCounty = new JTextField ();
    private JTextField fdCountry = new JTextField ();
    private JTextField fdPostCode = new JTextField ();
    private JTextField fdWebpage = new JTextField ();
    private JTextField fdPhone = new JTextField ();
    private JTextField fdFax = new JTextField ();
    private JTextField fdMobile = new JTextField ();
    private JLabel lblCompany = new JLabel("Company");
    private JLabel lblCompanyAddress = new JLabel("Company Address");
    private JLabel lblCompanyCity = new JLabel("Town");
    private JLabel lblCompanyCounty = new JLabel("County");
    private JLabel lblCompanyPostCode = new JLabel("ZIP/Post");
    private JLabel lblCompanyCountry = new JLabel("Country");
    private JLabel lblCompanyWebPage = new JLabel("Web Page");
    private JLabel lblJobTitle = new JLabel("JOB Title");
    private JLabel lblDepartment = new JLabel("Department");
    private JLabel lblOffice = new JLabel("Office");
    private JLabel lblCompanyPhone = new JLabel("Phone");
    private JLabel lblCompanyFax = new JLabel("Fax");
    private JLabel lblPager = new JLabel("Pager");
    private JLabel lblCompanyIPphone = new JLabel("IP Phone");
    private JTextField fdCompany = new JTextField ();
    private JTextField fdCompanyAddress = new JTextField ();
    private JTextField fdCompanyCity = new JTextField ();
    private JTextField fdCompanyCounty = new JTextField ();
    private JTextField fdCompanyPostCode = new JTextField ();
    private JTextField fdCompanyCountry = new JTextField ();
    private JTextField fdCompanyWebPage = new JTextField ();
    private JTextField fdJobTitle = new JTextField ();
    private JTextField fdDepartment = new JTextField ();
    private JTextField fdOffice = new JTextField ();
    private JTextField fdCompanyPhone = new JTextField ();
    private JTextField fdCompanyFax = new JTextField ();
    private JTextField fdPager = new JTextField ();
    private JTextField fdCompanyIPphone = new JTextField ();
    private JLabel lblSpouse = new JLabel("Spouse");
    private JLabel lblGender = new JLabel("Gender");
    private JLabel lblBirthday = new JLabel("Birthday");
    private JLabel lblAniversary = new JLabel("Aniversary");
    private JTextField fdSpouse = new JTextField ();
    private JTextField fdGender = new JTextField ();
    private JTextField fdBirthday = new JTextField ();
    private JTextField fdAniversary = new JTextField ();
    private JLabel lblNotes = new JLabel("Other Notes");
    private JTextArea taNotes = new JTextArea ();
    private ImageIcon imaNameInfo = new ImageIcon("nameinfo.gif");
    private JLabel lblNameInfo = new JLabel(imaNameInfo);
    private ImageIcon imaHomeInfo = new ImageIcon("homeinfo.gif");
    private JLabel lblHomeInfo = new JLabel(imaHomeInfo);
    private ImageIcon imaBusinessInfo = new ImageIcon("businessinfo.gif");
    private JLabel lblBusinessInfo = new JLabel(imaBusinessInfo);
    private ImageIcon imaPersonalInfo = new ImageIcon("personal.gif");
    private JLabel lblPersonalInfo = new JLabel(imaPersonalInfo);
    private ImageIcon imaOtherInfo = new ImageIcon("otherinfo.gif");
    private JLabel lblOtherInfo = new JLabel(imaOtherInfo);
    private JButton pane_butAddOK = new JButton("Ok");
    private JButton pane_butAddCANCEL = new JButton("Exit");
    //private JButton pane2_butAddOK = new JButton("Ok");
    private JButton pane2_butAddCANCEL = new JButton("Exit");
    //private JButton pane3_butAddOK = new JButton("Ok");
    private JButton pane3_butAddCANCEL = new JButton("Exit");
    //private JButton pane4_butAddOK = new JButton("Ok");
    private JButton pane4_butAddCANCEL = new JButton("Exit");
    //private JButton pane5_butAddOK = new JButton("Ok");
    private JButton pane5_butAddCANCEL = new JButton("Exit");
    private ImageIcon imaLeft = new ImageIcon("left.gif");
    private ImageIcon imaRight = new ImageIcon("right.gif");
    private JButton pane_butLEFT = new JButton(imaLeft);
    private JButton pane_butRIGHT = new JButton(imaRight);
    private JButton pane2_butLEFT= new JButton(imaLeft);
    private JButton pane2_butRIGHT= new JButton(imaRight);
    private JButton pane3_butLEFT = new JButton(imaLeft);
    private JButton pane3_butRIGHT = new JButton(imaRight);
    private JButton pane4_butLEFT = new JButton(imaLeft);
    private JButton pane4_butRIGHT = new JButton(imaRight);
    private JButton pane5_butLEFT = new JButton(imaLeft);
    private JButton pane5_butRIGHT = new JButton(imaRight);
    private JButton pane_butNEW= new JButton("Reset");
    private JButton pane2_butNEW = new JButton("Reset");
    private JButton pane3_butNEW = new JButton("Reset");
    private JButton pane4_butNEW = new JButton("Reset");
    private JButton pane5_butNEW = new JButton("Reset");
    private JTabbedPane tabbedPane = new JTabbedPane();
    private RandomAccessFile raf;
                   String inboundtext;
                   String Title, First, Middle, Last, NickName, Email;
                   String Address, Town, County, PostCode, Country, Phone, Fax,
                        Mobile, Webpage;
                   String Company, CompanyAddress, CompanyTown, CompanyCounty, CompanyPostCode,
                        CompanyCountry, Job, Department, Office, CompanyPhone, CompanyFax,
                        CompanyPager,CompanyIPPhone, CompanyWebpage;
                   String Spouse, Gender, Birthday, Aniversary;
                   String Notes;
                   public JTextArea area = new JTextArea();
                   BufferedReader br = null;
                   int Count;
    public TabbedPaneDemo()
              pane_butSave .setVerticalTextPosition(SwingConstants.BOTTOM);
                   pane_butSave .setHorizontalTextPosition(SwingConstants.CENTER);
              pane_butSave .setText("<html><center>"+"Update "+"<br>"+"Changes"+"</center></html>");
              pane_butAddOK .setVerticalTextPosition(SwingConstants.BOTTOM);
                   pane_butAddOK .setHorizontalTextPosition(SwingConstants.CENTER);
              pane_butAddOK .setText("<html><center>"+"New "+"<br>"+"Contact"+"</center></html>");
         //BufferedReader br = null;
         BufferedReader no = null;
         Count = 0;
         try
              br = new BufferedReader(new InputStreamReader(new FileInputStream("\\c:\\filename.txt")));
              String s = "";
              while((s=br.readLine()) != null )
                   Count = 1;     
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   if ( Count == 1 )
                        //fdTitle.setText(inboundtext);
                        fdTitle.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 2;
                   if ( Count == 2 )
                        //fdTitle.setText(inboundtext);
                        fdFirst.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 3;
                   if ( Count == 3 )
                        //fdTitle.setText(inboundtext);
                        fdMiddle.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 4;
                   if ( Count == 4 )
                        //fdTitle.setText(inboundtext);
                        fdLast.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 5;
                   if ( Count == 5 )
                        //fdTitle.setText(inboundtext);
                        fdNickName.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 6;
                   if ( Count == 6 )
                        //fdTitle.setText(inboundtext);
                        fdEmail.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 7;
                   if ( Count == 7 )
                        //fdTitle.setText(inboundtext);
                        fdStreetAddress.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 8;
                   if ( Count == 8 )
                        //fdTitle.setText(inboundtext);
                        fdCity.setText(inboundtext);
                        break;
         while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 9;
                   if ( Count == 9 )
                        //fdTitle.setText(inboundtext);
                        fdCounty.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 10;
                   if ( Count == 10 )
                        //fdTitle.setText(inboundtext);
                        fdCountry.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 11;
                   if ( Count == 11 )
                        //fdTitle.setText(inboundtext);
                        fdPostCode.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 12;
                   if ( Count == 12 )
                        //fdTitle.setText(inboundtext);
                        fdWebpage.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 13;
                   if ( Count == 13 )
                        //fdTitle.setText(inboundtext);
                        fdPhone.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 14;
                   if ( Count == 14 )
                        //fdTitle.setText(inboundtext);
                        fdFax.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 15;
                   if ( Count == 15 )
                        //fdTitle.setText(inboundtext);
                        fdMobile.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 16;
                   if ( Count == 16 )
                        //fdTitle.setText(inboundtext);
                        fdCompany.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 17;
                   if ( Count == 17 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyAddress.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 18;
                   if ( Count == 18 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyCity.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 19;
                   if ( Count == 19 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyCounty.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 20;
                   if ( Count == 20 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyPostCode.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 20;
                   if ( Count == 20 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyCountry.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 20;
                   if ( Count == 20 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyWebPage.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 21;
                   if ( Count == 21 )
                        //fdTitle.setText(inboundtext);
                        fdJobTitle.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 22;
                   if ( Count == 22 )
                        //fdTitle.setText(inboundtext);
                        fdDepartment.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 23;
                   if ( Count == 23 )
                        //fdTitle.setText(inboundtext);
                        fdOffice.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 24;
                   if ( Count == 24 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyPhone.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 25;
                   if ( Count == 25 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyFax.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 26;
                   Company = fdCompany.getText();
                   String comp = Company;
                   //System.out.println(Company);
                   if ( Count == 26 )
                        //fdTitle.setText(inboundtext);
                        fdPager.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 27;
                   if ( Count == 27 )
                        //fdTitle.setText(inboundtext);
                        fdCompanyIPphone.setText(inboundtext);
                        break;
                   while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 28;
                   if ( Count == 28 )
                        //fdTitle.setText(inboundtext);
                        fdSpouse.setText(inboundtext);
                        break;
                   while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 29;
                   if ( Count == 29 )
                        //fdTitle.setText(inboundtext);
                        fdGender.setText(inboundtext);
                        break;
                   while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 30;
                   if ( Count == 30 )
                        //fdTitle.setText(inboundtext);
                        fdBirthday.setText(inboundtext);
                        break;
              while((s=br.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = s;
                   Count = 31;
                   if ( Count == 31 )
                        //fdTitle.setText(inboundtext);
                        fdAniversary.setText(inboundtext);
                        break;
              no = new BufferedReader(new InputStreamReader(new FileInputStream("\\c:\\notes.txt")));
              String n = "";
              while((n=no.readLine()) != null )
                   //System.out.println("Data is " + s);
                   inboundtext = n;
                   Count = 32;
                        //taNotes.setText(inboundtext);
                        taNotes.append(n + '\n' );
                        First delete notes.txt
                                  You always want to take a mirror image of what is in the box at that time
                                  save that that to a new notes.txt*/
         catch(IOException ie)
         finally
              try
                   if(br!=null) br.close();
              catch(Exception e)
    File name = new File("\\c:\\filename.txt");
              if( name.isFile() )
                   try
                        BufferedReader input = new BufferedReader( new FileReader( name ) );
                        StringBuffer buffer = new StringBuffer();
                        String text;
                        while (( text = input.readLine() ) != null )
                        buffer.append( text + "\n" );
                        //buffer.append( buffer.toString() );
                        System.out.println(buffer);
                        inBoundtext.append( buffer.toString() );
                   catch( IOException ioException )
                        JOptionPane.showMessageDialog( this, "FILE ERROR", "FILE ERROR", JOptionPane.ERROR_MESSAGE );
         setLayout(new GridLayout(1,1));
              JPanel pane = new JPanel();
              pane.setLayout(null);
    //--------------NAME PANEL START----------------------------------------
         lblNameInfo.setBounds(10, 10, 500, 50);
         pane.add(lblNameInfo);
         lblFirst.setBounds(20, 60 ,50 ,50);
              pane.add(lblFirst);
              fdFirst.setBounds(60, 70, 70, 30);
              pane.add(fdFirst);
              lblMiddle.setBounds(150, 60 ,50 ,50);
              pane.add(lblMiddle);
              fdMiddle.setBounds(200, 70, 70, 30);
              pane.add(fdMiddle);
              lblLast.setBounds(300, 60 ,50 ,50);
    pane.add(lblLast);
    fdLast.setBounds(350, 70, 70, 30);
              pane.add(fdLast);
              lblTitle.setBounds(20, 100 ,50 ,50);
                   pane.add(lblTitle);
              fdTitle.setBounds(60, 110, 70, 30);
              pane.add(fdTitle);
              lblNickName.setBounds(150, 100, 70,50);
              pane.add(lblNickName);
              fdNickName.setBounds(220, 110, 70, 30);
              pane.add(fdNickName);
              lblEmail.setBounds(20,160, 100, 50);
              pane.add(lblEmail);
              fdEmail.setBounds(70, 170, 210,30);
              pane.add(fdEmail);
              pane_butLEFT.setBounds(10, 400, 50, 40);
              pane.add(pane_butLEFT);
    pane_butRIGHT.setBounds(450, 400, 50, 40);
    pane.add(pane_butRIGHT);
              pane_butAddOK.setBounds(160, 400, 70, 50);
              pane.add(pane_butAddOK);
              pane_butAddCANCEL.setBounds(240, 400, 90, 40);
              pane.add(pane_butAddCANCEL);
              pane_butSave.setBounds(340,400, 90, 40);
              pane.add(pane_butSave);
              pane_butNEW.setBounds(80, 400, 70, 40);
              pane.add(pane_butNEW);
              tabbedPane.addTab("Name", null, pane, "Name Information");
    tabbedPane.setSelectedIndex(0);
    //--------------NAME PANEL END----------------------------------------
    //--------------HOME PANEL START----------------------------------------
    JPanel pane2 = new JPanel();
    pane2.setLayout(null);
    //pane2.setLayout(new GridLayout(6, 6, 10, 10));
    tabbedPane.addTab("Home", null, pane2, "Home Information");
                   lblHomeInfo.setBounds(10, 10, 500, 50);
         pane2.add(lblHomeInfo);
         lblStreetAddress.setBounds(10, 60 ,100 ,50);
              pane2.add(lblStreetAddress);
              fdStreetAddress.setBounds(100, 70, 150, 30);
              pane2.add(fdStreetAddress);     
              lblCity.setBounds(10, 90 ,100 ,50);
              pane2.add(lblCity);
              fdCity.setBounds(100, 100, 100, 30);
              pane2.add(fdCity);
                   lblCounty.setBounds(10, 120 ,100 ,50);
              pane2.add(lblCounty);
              fdCounty.setBounds(100, 130, 100, 30);
              pane2.add(fdCounty);
              lblCountry.setBounds(10, 150 ,100 ,50);
              pane2.add(lblCountry);
              fdCountry.setBounds(100, 160, 100, 30);
              pane2.add(fdCountry);
              lblPostCode.setBounds(10, 180 ,100 ,50);
              pane2.add(lblPostCode);
              fdPostCode.setBounds(100, 190, 100, 30);
              pane2.add(fdPostCode);
              lblWebpage.setBounds(10, 250 ,100 ,50);
              pane2.add(lblWebpage);
              fdWebpage.setBounds(100, 260, 330, 30);
              pane2.add(fdWebpage);
              lblPhone.setBounds(270, 60 ,100 ,50);
              pane2.add(lblPhone);
              fdPhone.setBounds(310, 70, 100, 30);
              pane2.add(fdPhone);
              lblFax.setBounds(270, 90 ,100 ,50);
              pane2.add(lblFax);
              fdFax.setBounds(310, 100, 100, 30);
              pane2.add(fdFax);
              lblMobile.setBounds(270, 120,100 ,50);
              pane2.add(lblMobile);
              fdMobile.setBounds(310, 130, 100, 30);
              pane2.add(fdMobile);
                   pane2_butLEFT.setBounds(10, 400, 50, 40);
              pane2.add(pane2_butLEFT);
    pane2_butRIGHT.setBounds(450, 400, 50, 40);
    pane2.add(pane2_butRIGHT);
    /* pane2_butAddOK.setBounds(180, 400, 50, 40);
              pane2.add(pane2_butAddOK);*

  • Looping through text files loads all 2014 files correctly, but 2013 files only loads every other row

    Hello all. I am once again stumped and would very much appreciate any help.
    I have a folder with many text files such as this...
    A 2013-03-31.txt
    A 2013-06-30.txt
    A 2013-09-30.txt
    A 2013-12-31.txt
    A 2014-03-31.txt
    A 2014-06-30.txt
    A 2014-09-30.txt
    B 2013-03-31.txt
    B 2013-06-30.txt
    B 2013-09-30.txt
    B 2013-12-31.txt
    B 2014-03-31.txt
    B 2014-06-30.txt
    B 2014-09-30.txt
    …and so on…
    and I'm loading all of the files beginning with A to an existing table in SQL Server. I'm loading the data as is to a staging table, no data type conversions, and I add only two derived columns. I have a loop to accomplish this, and it's working perfectly
    except for one detail. All of the files in 2013 load every other row. All of the 2014 files load all rows as intended.
    Any idea what would cause this? All files are being loaded using the same loop, same variables, same everything. My enumerator on the for each loop is Foreach File. The DataRowsToSkip property on the flat file connection manager is 0. I'm not sure where
    to look next. I need all rows in all files to be loaded.
    Forgot to mention that there is a difference between the 2013 and 2014 files. The 2014 files have 8 additional columns. I suspect this is causing my issue, just not sure what to do about it.
    Thanks for any help you can provide!
    WeeLass

    In SSIS 2012 and above these additional columns would not cause a failure, but looks like lead to you having impartial loads.
    I suggest you create two loops, one for one metadata - files from 2014 and another for 2013 ones.
    Arthur
    MyBlog
    Twitter

  • Manually Search through sparsebundle files with finder

    Is there any way I can view the files of a sparsebundle file like opening a tar/zip file in finder?

    Jennifer Edwards wrote:
    Please don't flame the newbie here--what's QuickLook? Is that a separate utility I need in order to use the BetterZip plugin? I followed your BetterZip link and didn't find any info about where to get QuickLook.
    QuickLook is part of the OS that allows you to take a "quick look" inside a file. Select a file in the Finder and press the space bar.
    There are a number of QuickLook plugins for various file types. To install one just copy it to the "QuickLook" folder inside the "Library" folder in your home directory. You may have to create that folder.
    I'm a PC who just got a MacBook Air, and I'm extremely frustrated by the fact that I can't look inside my archives or add files to existing zip archives, which is standard in Windows 7. Why on earth would Finder assume I want to unzip the whole archive by default?
    Windows uses a very simple file system. MacOS X has a lot more going on underneath. It can't accurately represent Macintosh files on anything except a Macintosh file system. There are compatibility modes for things like servers and foreign file systems, but they are only for interfacing with those foreign systems. They shouldn't be used for day-to-day operations.
    I'm a writer and I zip all of my text and photos together for each article when they're published, but sometimes need to refer back. Sounds like QuickLook/BetterZip just might solve my problem.
    Don't forget Spotlight. While it is a bit of a hassle to update a zip file, you can search your computer (and any zip files therein) very quickly and easily for any data.

  • Searching into text files

    Hi friends!
    I'm working with Oracle8i and using ConText Cartridge to make
    searches in some fields of a table. The problem is that this
    table has a field to store a file name that contains large text.
    This field has type VARCHAR(128). I don't know how to make
    searches in this field. Can anybody help me, please?
    Thank you all in Advance
    Carlos Moreno

    Hi friends!
    I'm working with Oracle8i and using ConText Cartridge to make
    searches in some fields of a table. The problem is that this
    table has a field to store a file name that contains large text.
    This field has type VARCHAR(128). I don't know how to make
    searches in this field. Can anybody help me, please?
    Thank you all in Advance
    Carlos Moreno

  • Problem using a vector of strings as patterns to search a text file

    Ideas? Goal is to use several patterns from one file to search for matches in a second file, one pattern at a time. I have added the file of patterns to a vector and created an iterator to grab each pattern successively. I also can effectively search for matches in the second file, but can't seem to find a way to combine them. I've tried nested while(s) in both orders without success.
    Thank you for any suggestions.

    It sounds to me like it should work. What does your search code look like?

  • Which app to read and search a text file?

    I have a text doc containing a little database.. I want to keep on my iPhone and read .. but I also need to search it. Does any App do this?

    Well you can upload it somehow and then read it online. On your mac, go to any page and make it a bookmark. Then, press the little "book" icon by your bookmarks and then click on the bookmark you just made. Then change the web address of the bookmark you just saved to...
    javascript:void%28s%3Dprompt%28%27Find%20text%3A%27%2C%27%27%29%29%3Bs%3D%27%28% 27s+%27%29%27%3Bx%3Dnew%20RegExp%28s%2C%27gi%27%29%3Brn%3DMath.floor%28Math.random %28%29*100%29%3Brid%3D%27z%27%20+%20rn%3Bb%20%3D%20document.body.innerHTML%3Bb%3 Db.replace%28x%2C%27%3Cspan%20name%3D%27%20+%20rid%20+%20%27%20id%3D%27%20+%20ri d%20+%20%27%20style%3D%5C%27color%3A%23000%3Bbackground-color%3Ayellow%3B%20font -weight%3Abold%3B%5C%27%3E%241%3C/span%3E%27%29%3Bvoid%28document.body.innerHTML %3Db%29%3Balert%28%27Found%20%27%20+%20document.getElementsByName%28rid%29.lengt h%20%20%27%20matches.%27%29%3Bwindow.scrollTo%280%2Cdocument.getElementsByName%28rid %29%5B0%5D.offsetTop%29%3B
    Then sync this bookmark to your iPhone. Finally, open the database page you uploaded to the web on your iphone and go to the bookmark you just saved. You should then be able to search the document. Tell me if it works.

  • Can you search through text in an InDesign book?

    I need to do a find/replace on a certain string of text throughout my book in InDesign (made up of multiple document chapters).  Is this possible?  Or do I need to open each document individually and do a find/replace?
    Thanks.

    You can do a Find/Change on all OPEN documents.

  • Search word in text file

    Hello,
    someone can help me with code?
    How to search in text file any word and count how many it were repeated?
    For example test.txt:
    hi
    hola
    hey
    hi
    bye
    hoola
    hiAnd if I want to know how many times are repeated in test.txt word "Hi" program must say "3 times repeated"
    I hope you understood what I want, thank you for answers.

    This is my code now.
    package lt.kvk.i3_2.test;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.Scanner;
    public class Testing {
              public static void main(String args[]) throws Exception {
                   Scanner input = new Scanner(System.in);
                System.out.println("Select word from list:");
                System.out.println();
                try {
                        FileReader fr = new FileReader("src/lt/kvk/i3_2/test/List.txt"); // this is list of words, everything all right here
                        BufferedReader br = new BufferedReader(fr);
                        String s;
                        while((s = br.readLine()) != null) {
                             System.out.println(s);
                        fr.close();
                        String stilius = input.nextLine();   // eneter word which I want to count in File.txt
                    BufferedReader bf = new BufferedReader(new FileReader("src/lt/kvk/i3_2/test/File.txt")); // from this file I need to count word which I entered before
                    int counter = 0;               
                    counter = counter + 1;
                    counter++;
                    counter += 1;
                    String line;
                    System.out.println("Looking for information");
                    while (( line = bf.readLine()) != null){
                    int indexfound = line.indexOf(stilius);
                    if (indexfound > -1) {
                    System.out.println( "At all words which You want to count are "+ counter);
                    bf.close();
                catch (IOException e) {
                    System.out.println("Error");
              }         Here example of file.txt:
    test
    tea
    tree
    test
    car
    wind
    dog
    test
    car
    sea
    tea
    testIf I enter for example word "test" or any from this list I got answer:
    Looking for information
    At all words which You want to count are 3But it must to count how many times in this file this word are repeated, it must be 4
    if I enter word car It must show 2....
    And if I enter word which isn't in list (file.txt)
    Program didn't show error, just:
    Looking for informationThanks for answers.

Maybe you are looking for

  • Acrobat 9 pdf links not working from InDesign CS3. What is wrong?

    My links are working in my 40 page Indesign CS3 file using Mac. After I convert to a .pdf, some of the links are no longer going to the right location. They have either duplicated other links, or trying to take me incorrectly to my desktop or network

  • Firefox 4 not displaying certain content

    On the below website, since firefox 4 was released it was working fine, but since firefox 4, it doesnt display certain text, please see below the two links provided of pictures, one displaying a picture from Microsoft IE, and Firefox version. Microso

  • ?Inserting video/media into applet

    I've just gotten into applets. I found and finally today figured out how to insert audioClips into the applet, but i cannot find a way to insert video (wma, mov, ect..) files into the applet. I would greatly apreciate it if someone could NOT give me

  • Maximum Row Count - dynamically change

    Hi, How can I change dynamically (eg. from some item) value "Maximum Row Count" in "Report Attributes -> Layout and Pagination"? Is this possible? best regards, Jarek

  • NAC Cisco Agent cannot connect to LAN (Requirement Mandatory SCCM 2012 agent installed - ccmexec services)

    hi Support,  we have a problem, our NAC Cisco Agent cannot detect SCCM Agent Service (ccmexec).  here the snapshot: the configuration as following: here the NAC Cisco Agent Logs, download here: https://drive.google.com/file/d/0B9ShGyy3UzoeejlvZ2MwVVo