Searching a String in Script

Hi All,
I need one help is there any provision to search for string in standard or customized scripts....for example to search a string in programs..through program RPR_ABAP_SOURCE_SCAN i can search in program...same way how can i search for a text in scripts ??
Regards
VEnk@

Continue....
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
  STXL_ID-TDOBJECT = 'FORM'.
  STXL_ID-TDID = 'TXT'.
  SELECT * FROM STXL CLIENT SPECIFIED
          WHERE MANDT    = PA_MANDT
            AND RELID    EQ 'TX'
            AND TDOBJECT EQ 'FORM'
            AND TDID     EQ 'TXT'
            AND TDNAME   IN SO_NAME
            AND TDSPRAS  IN SO_SPRAS.
    MOVE-CORRESPONDING STXL TO I_STXL.
    APPEND I_STXL.
  ENDSELECT.
  SORT I_STXL.
  CLEAR HUIDIGE_TDSPRAS_TDNAME.
  CLEAR VORIGE_TDSPRAS_TDNAME.
  LOOP AT I_STXL.
    STXL_ID-TDNAME  = I_STXL-TDNAME.
    STXL_ID-TDSPRAS = I_STXL-TDSPRAS.
    STXL_ID-TDID    = I_STXL-TDID.
    CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME
                INTO HUIDIGE_TDSPRAS_TDNAME.
    IF HUIDIGE_TDSPRAS_TDNAME <> VORIGE_TDSPRAS_TDNAME.
      CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME
                                  INTO VORIGE_TDSPRAS_TDNAME.
      REFRESH LINES.
      CLEAR H_TEL.
      IMPORT TLINE TO LINES FROM DATABASE STXL(TX)
                                 CLIENT   I_STXL-MANDT
                                 ID       STXL_ID.
      LOOP AT LINES.
        IF LINES-TDFORMAT = '/W'.
          H_WINDOW = LINES-TDLINE.
        ENDIF.
        SEARCH LINES-TDLINE FOR H_STRING1.
        IF SY-SUBRC <> 0 AND H_STRING2 <> SPACE.
          SEARCH LINES-TDLINE FOR H_STRING2.
        ENDIF.
        IF SY-SUBRC EQ 0 AND LINES-TDFORMAT NE '/*'.
          H_POS = SY-FDPOS.
          IF NOT PA_ITEM1 IS INITIAL.
            ADD 8 TO H_POS.
          ENDIF.
          IF NOT PA_ITEM4 IS INITIAL.
            ADD 11 TO H_POS.
          ENDIF.
          H_LEN = STRLEN( PA_STR ).
          H_STRING = LINES-TDLINE+H_POS(H_LEN).
          IF H_TEL EQ 0.
            HIDE I_STXL-MANDT.
            HIDE STXL-TDNAME.
            HIDE I_STXL-TDSPRAS.
            WRITE: /001 I_STXL-MANDT,
                    005 STXL-TDNAME HOTSPOT ON,
                    036 I_STXL-TDSPRAS,
                    041 H_WINDOW(30).

Similar Messages

  • Help required- Searching Particular string in column

    Hi,
    I have a table by name temp and 2 values in the table. I'm using LIKE caluse to search a string. I'm getting output for some particular string. Please correct the below query for me.
    I have given a table/data reference for you:
    Create table temp(col1 varchar2(255));
    insert into temp values ('Test_Scale_High');
    1 row inserted
    insert into temp values ('Test_Scale_High');
    1 row inserted
    commit;
    select * from temp;
    col1
    Test_Scale_High
    Test_Scale High
    select * from temp where upper(col1) like '%TEST_SCALE%';
    COL1
    Test_Scale_High
    Test_Scale High
    select * from temp WHERE UPPER(COL1) LIKE '%TEST_SCALE_%';
    COL1
    Test_Scale_High
    Test_Scale High
    select * from temp WHERE UPPER(COL1) LIKE '%TEST_SCALE_H%';
    No Row Selected
    Thanks,
    Santhosh.S

    santhosh.shivaram wrote:
    select * from temp;
    col1
    Test_Scale_High
    Test_Scale High
    select * from temp where upper(col1) like '%TEST_SCALE%';
    COL1
    Test_Scale_High
    Test_Scale High
    select * from temp WHERE UPPER(COL1) LIKE '%TEST_SCALE_%';
    COL1
    Test_Scale_High
    Test_Scale High
    If I understand your requirement correctly you need to escape the Wild Card '_'
    Hope the following code helps:
    SQL> set feedback on;
    SQL> SELECT * FROM TEMP
      2  /
    COL1
    Test_Scale_High
    Test_Scale High
    2 rows selected.
    SQL> SELECT *
      2    FROM temp
      3   WHERE UPPER (col1) LIKE '%TEST_SCALE%'
      4  /
    COL1
    Test_Scale_High
    Test_Scale High
    2 rows selected.
    SQL> SELECT *
      2    FROM temp
      3   WHERE UPPER (col1) LIKE '%TEST_SCALE\_%' ESCAPE '\'
      4  /
    COL1
    Test_Scale_High
    1 row selected.
    SQL> SELECT *
      2    FROM temp
      3   WHERE UPPER (col1) LIKE '%TEST_SCALE_H%'
      4  /
    COL1
    Test_Scale_High
    Test_Scale High
    2 rows selected.
    SQL> SELECT *
      2    FROM temp
      3   WHERE UPPER (col1) LIKE '%TEST_SCALE\_H%' ESCAPE '\'
      4  /
    COL1
    Test_Scale_High
    1 row selected.
    SQL>Regards,
    Jo
    Edited by: Joice John : Added 2 Sample Codes

  • How to search a string in some folder.

    Hi ,
    In my application users will upload some pdf,xls files to server. files will be saved in server. From the front end can search on all files with some specific string. If that string is there in any of the file, user has to get link to download that file and the text just before and after that user string. Its like how we get in google. This type of search we need to implement, Could any one please let me know how to implement, any free API are there in java. Please its urgent, help on this.
    Thanks
    Mohan

    user594301 wrote:
    I have 2 columns in a table. entry_no and msg_txt. entry_no is number(12) and msg_txt is LONG. I want to search one string in msg_txt. How can I write a query for this ?You can't write a query for this. The only thinks you can do with a long in a query is put something in and take it out again - with diffiuclty, usually.
    You can write a PL/SQL function to do this for you if necessary. The function will have to perform the search directly if the long < 32760 bytes or use DBMS_SQL to break the LONG up into 32760 byte segments that can then be manually searched. If you are lucky someone has done this already and posted the code online. Either way the solution will be slow and probably painful to implement.
    If possible convert your data to a CLOB and use DBMS_CLOB to find the data you need.

  • Search a string with in some file and get the name of file

    i want to search a string in some files that are in a given directory and return the name of file having searched string.I am doing this with grep command as given below
    import java.io.*;
    public class linux_java {
    public static void main(String[] args) {
    try {
    String command = "find . | xargs grep -l Resolv /data2/opt/jakarta-tomcat-4.1.24/webapps/Oa/BOG/*.txt";
    final Process process = Runtime.getRuntime().exec(command);
    OutputStream os= process.getOutputStream();
    System.out.println("out put stream= " +os);
    PrintStream stdIn = new PrintStream(new BufferedOutputStream(process.getOutputStream()), true);
    System.out.println("Return code = " + stdIn);
    } catch (Exception e) {
    e.printStackTrace();
    i dont know how to get the name of file that are return by the execution of command through process object. Please send the code for the same

    thanks for your suggestion....
    i change the code but now it is giving error as /usr/bin/find incomplete syntax....but i am giving the right syntax....
    please confirm whether the syntax is correct...
    import java.io.*;
    import java.util.*;
    public class linux_java {
    public static void main(String[] args) {
    try {
    //String command = "ls -alt";
    String command = "find /data2/opt/jakarta-tomcat-4.1.24/webapps/Oa/BOG -type f -exec grep -sl 'Aggarwal' {} \\; 2>/dev/null";
    ///grep -l System test/*java
    System.out.println(" the command is"+command);
    final Process process = Runtime.getRuntime().exec(command);
    InputStream is = process.getErrorStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line="";
    System.out.println(" the BufferedReader is"+br.readLine());
    while ((line = br.readLine()) != null) {
    System.out.println(" the files are"+line);
    } catch (Exception e) {
    e.printStackTrace();
    }

  • How to search a string from the database?

    how to search a string from the database? starting with some character

    If you're trying to do this in a SELECT, you can use the LIKE verb in your WHERE clause.
    Here's an Example
      SELECT obj_name FROM tadir
        INTO prog
        WHERE pgmid = 'R3TR'
          AND object = 'PROG'
          AND obj_name LIKE 'Z%'.
    In this case it will select every row that obj_name starts with Z. 
    If you wanted to find every row that the field obj_name contains say... 'WIN'  you use LIKE '%WIN%'.
    Edited by: Paul Chapman on Apr 22, 2008 12:32 PM

  • Increasing the speed of searching a string in a file

    I have to search a String in a big ASCII-file and have to delete it. Now I wrote a program which opens the source file and a target file. I am reading each line from the source file, check it and write it into the target file. It is working fine but it is very slowly.
    I check each line with:
    if (line.equalsIgnoreCase("xxxxx")) { }
    How can I make it much faster.
    Thank you for your help!
    Arthur

    IO is an issue, but I've noticed that changing the case of strings is very slow, probably because in unicode is harder than in ASCII.
    If you could replace the equalsIgnoreCase method by one or more equals, you'll get benefits. If you can, I would try something like the following to minimize the equalsIgnoreCase invocations:
    // Supose you are looking for "abcd"
    if (line.charAt(0) == 'a' || line.charAt(0) == 'A') {
       if (line.equals("xxxxx")) { }
    }Try it and let us know if it worth the effort.

  • Is it possible to search for strings containing spaces and special characters?

    In our RoboHelp project, there are figures with text labels such as Figure 1, Figure 3-2, etc.
    When I search for "Figure 3" I get all pages containing "Figure" and "3", even if I surround it in quotes.  Similarly, searching for "3-2" treats the '-' character as a space and searches for all pages containing '3' or '2'.
    Is there a way to search for strings containing spaces and special characters?

    In that case I think the answer is no if you are using the standard search engine. However I believe that Zoom Search does allow this type of searching. Check out this link for further information.
    http://www.grainge.org/pages/authoring/zoomsearch/zoomsearch.htm
      The RoboColum(n)
      @robocolumn
      Colum McAndrew

  • Searching a string in Forms V5.

    Hi all,
    My requirement is to search a string in a Form (Forms Version 5.0.6.8.0. However If I go to <Filie-Administration-Object list report), I am getting a ascii file. All the objects in the form are listed in the file. So, I do a 'Search' of my required String in the ascii file.
    However, in the <Ascii> file, I find that the program units are not converted to txt file. Only the program unit's name is present.
    Is there any other method, by which I can search my required string in the form(includding all program units, viz., triggers, program units)?
    Thanks in advance for ur help.
    null

    Maybe this will help you:
    We have FREE versions of FormDiff and FormGrep,the productivity tools for Oracle Developer, available for downloading now.
    There are NO FORMS to fill out, NO LIMIT on how long you can use them and best of all NO COST.
    Check out the latest FormDiff features and download your FREE VERSION now: http://www.aug10.com/products/FormDiff
    Using FormDiff, you can now document changes made to Forms and perform meaningful code reviews.
    Checkout the latest FormGrep features and download your FREE VERSION now: http://www.aug10.com/products/FormGrep
    Using FormGrep, you can 'Find and Replace PL/SQL code' across hundreds of FMBs at a time.
    Thank you for your time,
    Jesse Johnson - Managing Principal
    August Tenth Systems, Inc.
    PO Box 3682
    Boulder, CO 80307-3682 http://www.aug10.com/
    Helena

  • SPECIFYING THE NUMBER OF IDENTICAL CHARACTERS WHEN SEARCHING A STRING

    Hey everyone,
    The built-in function indexOf() searches for a character "." in the string "1.2.3." if the value == 1.
    It searches nothing if the value == 0 or 2 or any number greater than 2.
    var txt:String = "1.2.3.";
    var output:String = String(this);
    if (txt.indexOf(".") == 1)
    trace(output);     //[object MainTimeline]
    The must be a simple method for specifying the number of characters "." when searching the string "1.2.3.".
    For example if there is 2 characters "." in the string "1.2.", then run through a statement but if it does not contain 2 characters "." then do nothing.
    There is a built-in function called contains but it is mainly used in XML.
    indexOf() looks like unstable javascript codes, one of those framework that unixers hate.

    Why have an alternative when the built-in RegExp class does the job better than anything else?   Is it that you find them too hard to work with?  If you want a one line solution and prefer to use the older built-in methods you can do so by creating your own custom class to do what you want... searching a string character by character for the one you wish to isolate and counting them.
    In any case, you have a solution to counting the number of "." characters.
    "Many" people say what?  I doubt many people say anything like that at all.

  • Search functionality for SAP script

    All,
    I am looking some of kind utility or report like RPR_ABAP_SOURCE_SCAN for sap script.
    This is my requirement
    One of the country code has been hardcoded in various forms (sapscripts) i like to scan all custom sapscripts and find all these form names so that i can easily change.
    Is there any way to do this ?

    REPORT ztextscan.
    TABLES stxh.
    SELECT-OPTIONS:
      object FOR stxh-tdobject DEFAULT 'FORM',
      name   FOR stxh-tdname,
      id     FOR stxh-tdid DEFAULT 'TXT',
      spras  FOR stxh-tdspras.
    PARAMETERS text TYPE string.
    DATA gt_lines TYPE TABLE OF tline WITH HEADER LINE.
    SELECT * FROM stxh
      WHERE tdobject IN object AND
            tdname IN name AND
            tdid IN id AND
            tdspras IN spras.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          id                      = stxh-tdid
          language                = stxh-tdspras
          name                    = stxh-tdname
          object                  = stxh-tdobject
        TABLES
          lines                   = gt_lines
        EXCEPTIONS
          id                      = 1
          language                = 2
          name                    = 3
          not_found               = 4
          object                  = 5
          reference_check         = 6
          wrong_access_to_archive = 7
          OTHERS                  = 8.
      CHECK sy-subrc = 0.
      LOOP AT gt_lines.
        SEARCH gt_lines-tdline FOR text AND MARK.
        CHECK sy-subrc = 0.
        WRITE:/ stxh-tdid, stxh-tdspras, stxh-tdname, stxh-tdobject, gt_lines-tdline.
      ENDLOOP.
    ENDSELECT.

  • Search for string in paragraph and apply a new character style?

    I'm searching for a way to find a specific string in a specific text frame and make it bold. so my thought was to search and then apply a character style from my template doc. I thought this would work, but I went wrong somewhere.
    newDoc is my document. 
    //something like
    var Bios = "Representative Biography:\r want to leave this text normal.";
    var myTextFrameBios = newDoc.pages.item(i).textFrames.add({geometricBounds:[4.5277, 2.36, 8.625, 5.375], contents:Bios});
    var myTextObjectBios = myTextFrameBios.parentStory.texts.item(0);
    // IS THIS CONFLICTING with my change below? Can I apply a character style within a par styled frame?
    myTextObjectBios.appliedParagraphStyle = newDoc.paragraphStyles.item("CompanyProfile");
                                                      //Clear the find/change preferences.
                                                    app.findGrepPreferences = NothingEnum.nothing;
                                                    app.changeGrepPreferences = NothingEnum.nothing;
                                                    app.findTextPreferences.findWhat = "Representative Biography:";
                                                    app.changeTextPreferences.changeTo = "Representative Biography:";
                                                    app.findGrepPreferences.appliedCharacterStyle = newDoc.characterStyles.item("BoldBioHead");
                                                    // Perform the operation
                                                    app.documents.item(0).changeGrep();
                                                    app.findGrepPreferences = NothingEnum.nothing;
                                                    app.changeGrepPreferences = NothingEnum.nothing;

    @caseyctg – If you want to apply a character style to a text object in a specific text frame, you could restrict the scope of your script to that specific text frame:
    Example with the variable "myTextFrame" you have to define before:
    myTextFrame.changeText();
    Btw.: you are doing a text search and clearing your GREP find/change preferences at the start of the snippet? Why is that?
    You could do a:
    app.changeTextPreferences = app.findTextPreferences = NothingEnum.nothing;
    or:
    app.changeTextPreferences = app.findTextPreferences = null;
    set before the search and after the change, if you want to be on the safe side…
    Uwe

  • A better way to search a string in a 3GB txt file

    I am looking for a string(12 characters) in a 3GB txt file. I use the file reader to go though each line and use the startwith() (that 12 characters are from the beginning of each line) to check if that line contain the string I am searching for. Is there a faster way to do it? Thank's.

    I would avoid using java to parse/search a 3 GB text file at all costs. Any java solution is going to have terrible performance and you may run into memory problems. I would recomend that you either a) develop a native method for resolving this search and just invoke it from your current java class or b) use Runtime.exec to invoke a native OS command for searching the file (like grep or find) and parse the results. ....
    I'm not even sure how I would complete that task with java exclusivly ... maybe break the file into smaller parts, then iterate through each smaller, temporary file ... I would really recomend storing your data in a different format if possible. A 3 GB text file just isn't very partical or secure.
    ... oh, to answer your original question (which I'm not sure if I all ready did), the fatest way to load the file is to wrap it into some BufferedReader. The fatest way to perform String searches is through the java.util.regex package if you have access to the 1.4 API. Other wise, just use basic String searches, as you all ready are.

  • Searching TEXT String in a document stored in BLOB Column

    Hi,
    I fairly new to this concept of Oracle iText. I would like to get the atmost procedural approach to meet the following scenario.
    I have a table with 3 columns (viz. id,name, content) of which content is a BLOB datatype. I have stored a simple .doc file in this column. (Just one row has been stored into this table ). I am aware that this document contains my search word say 'TOPIC'.
    These are the following steps i did to get my soln but didnt meet my expected result.
    1. Inserted the row into the table ..... successful
    2. Tried to do a simple select (using contains)after creating context index....no rows selected
    3. Tried to create preference (DIRECT_PREFERENCE) and create an index using this PREFERENCE and do the select for the search string......no rows selected
    It would b great if u would let me know, how can i retrive the doc info ie. atleast the id,name from the database if i get a matched search string in the table.
    Regards
    Kevin

    When you index BLOBs (or RAW, or file) the product assumes that you have some kind of
    binary data -- like Microsoft Word or something like that. It then automatically
    engages the INSO filter.
    In your case, if I understand correctly, you have text data stored in a blob.
    So INSO filtering is not appropriate. So you will want to tell the product not to
    use INSO:
    create index ...
    parameters ('filter ctxsys.null_filter');
    try that...

  • Searching a string in a table.

    Hi,
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production.
    I have a situation where I need to find the number of occurrences of a string that is present in a table having comma separated values. To explain with an example:
    create table test_data ( textfield varchar2(100));
    insert into test_data values('DM,HM');
    insert into test_data values('EM');
    insert into test_data values('AM,CA,CD,FM,ST');
    insert into test_data values('LS');
    insert into test_data values('TQ,SP,AM,FM,ST,CA,CD');
    insert into test_data values('TQ,SP,AM,FM,ST,CA,CD,LS');
    insert into test_data values('DM,HM,LS');
    The data in the table test_data looks like
    DM,HM
    EM
    AM,CA,CD,FM,ST
    LS
    TQ,SP,AM,FM,ST,CA,CD
    TQ,SP,AM,FM,ST,CA,CD,LS
    DM,HM,LS
    Now I need to search"LS" in the table test_data. Basically, I need to find if "LS" is present at least once in any of the rows or not. Please note that I want to avoid looping here.
    Thanks
    DS

    Hi,
    Watch out for the "Mother is in chemotherapy" problem.
    If one key can be a substring of another, then Kapil's solution will be too lax.  For example, if you're looking for 'LS', it will match words like 'ALSO' and 'GALS'.  In that case, you need something like this:
    SELECT  COUNT (*) AS num_rows
    FROM    test_data
    WHERE   ',' || textfield || ','   LIKE '%,LS,%'
    You could get the same results with regular expressions, but they would be slower, and not much simpler (if any).
    Why do you have data like that in your table?  Relational databases were designed to have only 1 item in each column of each row.  That's something so basic to table design that it's called First Normal Form.  You application could be much simpler and faster if you redesigned the table so that it had more rows, with less on each row, or pehaps put this information in a separate table.

  • Searching for strings in a txt file

    I am writing a program based on the six degrees of seperation theory.
    Basically I have been given a (very large) txt file from the imdb with a list of all the films written in it.
    The text in the document is written like this:
    'Tis Autumn: The Search for Jackie Paris (2006)/Paris, Jackie/Moody, James (IV)/Bogdanovich, Peter/Vera, Billy/Ellison, Harlan/Newman, Barry/Whaley, Frank/Murphy, Mark (X)/Tosches, Nick (I)/Moss, Anne Marie
    (Desire) (2006)/Ruggieri, Elio/Micijevic, Irena
    .45 (2006)/Dorff, Stephen/Laresca, Vincent/Eddis, Tim/Bergschneider, Conrad/Campbell, Shawn (II)/Macfadyen, Angus/John, Suresh/Munch, Tony/Tyler, Aisha/Augustson, Nola/Greenhalgh, Dawn/Strange, Sarah/Jovovich, Milla/Hawtrey, Kay
    10 Items or Less (2006)/Ruiz, Hector Atreyu/Torres, Emiliano (II)/Parsons, Jim (II)/Freeman, Morgan (I)/Pallana, Kumar/Cannavale, Bobby/Nam, Leonardo/Hill, Jonah/Vega, Paz/Echols, Jennifer/Dudek, Anne/Berardi, Alexandra
    10 MPH (2006)/Weeks, Hunter/Armstrong, Pat (II)/Caldwell, Josh/Waisman, Alon/Keough, Johnathan F./Weeks, Gannon
    10 Tricks (2006)/Cruz, Raymond/Swetland, Paul/Selznick, Albie/Hennings, Sam/Gleason, Richard/Leake, Damien/Skipp, Beth/Ishibashi, Brittany/Thompson, Lea (I)/Jinaro, Jossara/Brink, Molly
    1001 Nights (2006)/Wright, Jeffrey (I)
    10th & Wolf (2006)/Lee, Tommy (VI)/Renfro, Brad/Ligato, Johnny/De Laurentiis, Igor/Luke Jr., Tony/Mihok, Dash/Garito, Ken/Capodice, John/Dennehy, Brian/Gullion, Jesse/Salvi, Francesco (I)/Cordek, Frank/Marsden, James (I)/Bernard, Aaron/Brennan, Patrick (VII)/O'Rourke, Ben/Gallo, Billy/Heaphy, James/Stragand, Dave/Vellozzi, Sonny/Pistone, Joe (I)/Morse, David (III)/Landis, Pete/Cain, Atticus/Trevelino, Dan/Demme, Larry/Sisto, Frank/Rosenbaum, Paul/Grimaldi, James (I)/Ribisi, Giovanni/Hopper, Dennis/Devon, Tony/Sigismondi, Barry/Kilmer, Val/Marinelli, Sonny/Cacia, Joseph/Rossi, Leo (II)/Tott, Jeffrey/Wawrzyniak, Aaron/Boombotze, Joey/Marie, Corina/Arvie, Michilline/Warren, Lesley Ann/De Laurentiis, Veronica/Moresco, Amanda/Boecker, Margot/Rossi, Rose/Latimore, Meritt/Dunlap, Doreen/Perabo, Piper/Horrell, Nickole/Sonnichsen, Ingrid
    11 Minutes Ago (2006)/Irving, Len/Welzbacher, Craig/Michaels, Ian/Dahl, Evan Lee/Gebert, Bob/Juuso, Jeremy/Hope, Trip/Green-Gaber, Renata/Dawn, Turiya/Reneau, Taryn/M
    Thats just 2 lines!
    what the program will do is take in a name (from a gui) of an actor/actress and find the smallest connection to a famous actor.
    So first things first, my idea of thinking is to search the file for K.E.V.I.N. B.A.C.O.N and all his films, and safe them into an array. Then do another search for films from the actor that the user entered at the gui. then find the shortest possible connection to both stars.
    my code for the search part of the program
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.File;
    import java.io.FileNotFoundException;
    public class FileSearch {
         File aFile = new File("cast.06.txt");     
         FileInputStream inFile = null;
         String actor = "surname, forename"; // the person who will be the centre point e.g. kevin.bacon.
           //get the result of the actor from the gui will go here.
         public void openFilm()
              try
                  inFile = new FileInputStream(aFile);     
              catch(FileNotFoundException e)
                   System.out.println("Error");
    }The problem I have is that I can't work out how to search the txt file for a specific string/s and save them into an array. (I'm not sure if this is the best way to go about it or not at this stage).
    So whats the best way to search for an actor from that file and save the film title and the year of release?
    Hope this makes sense? what I hope the final program will be like is like this http://oracleofbacon.org/

    I went away and looked at regular expressions and this is what I came up with
    public class NameSearch{
         public static void main(String[] args)
              NameSearch ns = new NameSearch();
              ns.runIt();
         public void runIt()
              java.util.Scanner fileScan = null;
              try{
                   fileScan = new java.util.Scanner(new java.io.File("imdb.txt"));
              }catch(java.io.FileNotFoundException e)
                   e.printStackTrace();
                   System.exit(0);
              String token = null;
              String actor = "Surname, Forename";
    //real name will go in actor, left it like that for example
              while(fileScan.hasNext()){
                   token = fileScan.next();
                   Pattern pattern = Pattern.compile(actor);
                   Matcher m = pattern.matcher(token);
                   while(m.find())
                        System.out.println(m.start() + m.end());
    }This by any means not finished, I'm just trying to get to grips with regualr expressions. But when I run the program it doesn't return anything, from what I've tried to work out is it should return actor x amount of times they appear in the file. But when I run it nothing comes back (the actors name is in the text file) so I'm not too sure what I'm doing wrong, any suggestion please

Maybe you are looking for

  • How to trigger automatically an IDOC and RFC from SAP R/3 system?

    Hi , lets say if we are implementing IDOC to FILE &RFC to FILE scenario ,how can we trigger  on timely basis(schedules) 1)standard IDOCs and BAPIs? 2)customized Idocs and Customized Bapis? 3)Master Idocs and transactiona Idocs?I think we need to use

  • Cant get my head round delimited files

    hey guys i have been trying to sort this out for ages but i just cant get it to display correctly just wondering if any one could help Create a comma delimited file for example:      Smith, Jon      Bloggs, Fred      Jones, Anne Then simply read each

  • HTTP PL/SQL gateway intermediate output

    Hi, I'm trying to use the HTTP PL/SQL gateway to serve up simple pages generated usin PL/SQL. (Stuff like OWA_UTIL & HTP packages). I have one page/PL/SQL function which is extremely long running, so I want to send intermediate outputs to the users b

  • I want an itunes account but i dont have a credit card

    Is there a way to get around this?

  • Adobe Support is an oxymoron

    I purchased ColdFusion 8.0 from the university computer center and received the standard edition educational version. After installing as a 30 day evaluation and validating the install (downloaded 8.01), I entered my serial number. The CF administrat