Regular Expression to Search Comma Delimited File for any of 3 Values

Hi,
I'd like to parse a table column that contains a comma delimited string for any of 3 values, 1200, 1400, 1600 just to see if they're present using Regexp_instr. If someone has an expression available please pass it along.
Thanks,
Victor

Or you could do it like this too...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select 1 as id, '1000,2000,3000' as txt from dual union all
  2             select 2, '1200,1300,1400' from dual union all
  3             select 3, '1000,1300,1600' from dual)
  4  -- end of test data
  5  select *
  6  from t
  7* where regexp_like(txt,'(^|,)(1200|1400|1600)(,|$)')
SQL> /
        ID TXT
         2 1200,1300,1400
         3 1000,1300,1600

Similar Messages

  • Urgent + Search a delimited file for more then one string

    Hi All
    Urgent please help I am trying to search a file for 2 different strings.
    This is how the command prompt will look like
    java match "-t|" -4 -f Harvey -10 -f Atlanta callbook.txtPlease help me with identifying how many search criterias have been entered on command prompt.
    "-t|" - denotes a delimiter
    -4 - denotes the field number
    -f - case sensitive
    Thanks

    Hi
    Thanks for your quick response and I apologise I will never put urgent on my posting again.
    C:\>java match "-t|" -4 -f Harvey -10 -f Atlanta callbook.txt
    This example lists records for Atlanta with first name Harvey.
    I am able to get one search criteria but when I have 2 as above (Harvey and Atlanta) I get lost I do not know how to get these arguments from the commandline and still do a search correctly. My code at the moment is doint a hard coded search so I was trying to extract the arguments that's where I got stuck.
    The main aim of my app is to search a delimited file for a search criteria passed through a command prompt.
    This is what I have done so far.
    import  java.io.*;
    import java.util.*;
    public class assess1
        static public void main(String args[])
            int[] totals = new int[10];
            try
                BufferedReader inFile = new BufferedReader(new FileReader(args[0]) );
                try
                    String line;
              String StrSearch = "HARVEY";
              int counter = 0;
                    boolean foundIt = false;
                    while((line = inFile.readLine()) != null)
                     // search for the string
                      String[] values = line.split("\\|");
                       for (String str : values) {
                   if (str.equals("HARVEY")) {
                               System.out.println(line);
                             System.out.println();
                        counter++;
              if (counter == 0) {
                   System.out.println("String not found");
              inFile.close();
                catch(IOException e)
                    System.err.println("IO exception");
                    System.exit(1);
                catch(NumberFormatException e)
                    System.err.println("Value " + e.getMessage() + "not numeric");
            catch(FileNotFoundException e)
                System.err.println( "Couldn't open " + e.getMessage() );
                System.exit(1);
    }

  • Comma delimited file in application server.

    How to extarct a comma delimited file from an internal table in to SAP application server.

    Hi Arun,
    Can you be a bit more clearer? Are you uploading the dat to the appl server or downloading?
    1) Comma separated info from itab to file server.
    loop at itab.
    concatenate itab-field1
                itab-field2
                 itab-field3
    into itab_new-data separated by ','.
    append itab_new.
    clear itab_new.
    endloop. 
    open dataset dsn for output in text mode.
    if sy-subrc = 0.
    loop at itab_new.
    transfer itab_new to dsn.
    endloop.
    endif.
    close dataset.
    2) Comma separated info from file to itab.
    open dataset dsn for input in text mode.
    if sy-subrc = 0.
    do.
    read datset dsn into itab-data.
    if sy-subrc <> 0.
    exit.
    else.
    append itab.
    clear itab.
    endif.
    enddo.
    endif.
    close dataset.
    loop at itab.
    split itab-data at ',' into  itab_new-field1
                itab_new-field2
                 itab_new-field3.
    append itab_new.
    clear itab_new.
    endloop. 
    REgards,
    Ravi

  • Passing data to different internal tables with different columns from a comma delimited file

    Hi,
    I have a program wherein we upload a comma delimited file and based on the region( we have drop down in the selection screen to pick the region).  Based on the region, the data from the file is passed to internal table. For region A, we have 10 columns and for region B we have 9 columns.
    There is a split statement (split at comma) used to break the data into different columns.
    I need to add hard error messages if the no. of columns in the uploaded file are incorrect. For example, if the uploaded file is of type region A, then the uploaded file should be split into 10 columns. If the file contains lesser or more columns thenan error message should be added. Similar is the case with region B.
    I do not want to remove the existing split statement(existing code). Is there a way I can exactly pass the data into the internal table accurately? I have gone through some posts where in they have made use of the method cl_alv_table_create=>create_dynamic_table by passing the field catalog. But I cannot use this as I have two different internal tables to be populated based on the region. Appreciate help on this.
    Thanks,
    Pavan

    Hi Abhishek,
    I have no issues with the rows. I have a file with format like a1,b1,c1,d1,e1, the file should be uploaded and split at comma. So far its fine. After this, if the file is related to region A say Asia, then it should have 5 fields( as an example). So, all the 5 values a1,b1..e1 will be passed to 5 fields of itab1.
    I also have region B( say Europe)  whose file will have only 4 fields. So, file is of the form a2,b2,c2,d2. Again data is split at comma and passed to itab2.
    If some one loads file related to Asia and the file has only 4 fields  then the data would be incorrect. Similar is the case when someone tries to load Europe file with 5 fields related data. To avoid this, I want to validate the data uploaded. For this, I want to count the no. of fields (seperated by comma). If no. of fields is 5 then the file is related to Asia or if no. of fields is 4 then it is Europe file.
    Well, the no. of commas is nothing but no. of fields - 1. If the file is of the form a1,b1..e1 then I can say like if no. of commas = 4 then it is File Asia.But I am not sure how to write a code for this.Please advise.
    Thanks,
    Pavan

  • Reading comma delimited files

    Hi,
    What are the FMs that I can use to read comma delimited files. Also, will it be able to run in the background?
    Thanks,
    RT

    Hi Rob
       As far as i know, we can not upload data from
    persentation server in background. For that the file
    needs to be placed in application server and use Open dataset command.
    Below is just an example to help you have a feel of the
    same.
    eg:
    type: begin of t_data,
            vbeln like vbak-vblen,
            posnr like vbap-posnr,
            matnr like vbap-matnr,
            menge like vbap-menge,
          end of t_data.
    data: it_data type standard table of t_data.
    data: wa_data type t_data.
    data: l_content(100) type c.
      open dataset p_file for output in text mode.
      if sy-subrc ne 0.
    *** error reading file.
      else.
        do.
          read dataset p_file into l_content.
          if sy-subrc ne 0.
             close dataset p_file.
             exit.
          else.
             split l_content at ',' into wa_data-vbeln
               wa_data-posnr wa_data-matnr wa_data-menge.
             append wa_data to it_data.        
          endif
        enddo.
      endif.
    Hope this helps you.
    Kind Regards
    Eswar

  • Is it possible to download a comma delimited file from ABAP to a Portal

    directory or Web Dev URL on the Portal?
    We currently have a comma delimited file being emailed nightly using standard SAP FMs to a distribution list.
    We want to move these files to the Portal instead.
    Speaking with our Portal guys, they say the easiest way for them to receive the file is if I can download directly to a Web Dev URL.
    Does SAP provide a way to communicate from our app server to the portal?
    thanks alot,
    rp.

    Is it possible to verify a signed jar-file from a
    program
    (using some API) likewise jarsigner does?Hi,
    You would have to open the jarfile, read each jar entry and for each of them do a getCertificates() and then in turn verify each certificate with the public key of the enclosed certificates in the jar file.
    An easier solution would be to use the verify flag of the JarFile or JarInputStream.
    Hope it helps..
    Cheers,
    Vijay

  • Is it possible to download a comma delimited file to..

    a Web Dev URL on the SAP Portal?
    We currently have a comma delimited file being emailed nightly using standard SAP FMs to a distribution list.
    We want to move these files to the Portal instead.
    Speaking with our Portal guys, they say the easiest way for them to receive the file is if I can download directly to a Web Dev URL.
    Does SAP provide a way to communicate from our app server to the portal?
    thanks alot,
    rp.

    Are you trying to convert a list of your forms or a list of the responses to your forms?
    Andrew

  • How to search a .csv file for data using its timestamp, then import to labview

    Hi, I'm currently obtaining density, viscosity and temperature data from an instrument, adding a timestamp and writing it to a .csv file which I can view in Excel. This works fine (see attached code) but what I need to do now is to search that csv file for data which was obtained at a certain time, import the temperature, density & viscosity values at this time back into Labview to do some calculations with them, while the data acquisition process is still ongoing.
    I've found various examples on how to import an entire csv file into labview, but none on how to extract data at a specific time. Also, whenever I try to do anything with the .csv file while my data acquistion VI is running, I receive error messages (presumably because I'm trying to write to and import data from the .csv file simultaneously). Is there some way around this, maybe using case structures?
    If you need to know my skill level, I've been using Labview for a few weeks and prior to that have basically no experience of writing code, so any help would be great. Thanks!
    Solved!
    Go to Solution.
    Attachments:
    Lemis VDC-30 read registers MODBUS v5.vi ‏56 KB

    It sounds as if you are going about this a little backwards writing to a data file and then extracting from the file but its the weekend so I can't think of an improved way to do it at the moment. 
    Searching for a specific time with those specific values is quite easy, or if you wanted to select any time then you could interpolate the values to find any value that you want (This is where the contiguous measurement comes in, as you have readings at discrete times you will have to interpolate the values if you want to get the 'measured value' at a time point that is not exactly one of your measured points).
    If you can extract the TDMS time column and the T, D & V then simply thresholding and interpolating each of your array/data sets should allow readings at your desired times.
    Attachments:
    Interpolate.png ‏301 KB

  • How to read and parse a comma delimited file?  Help

    Hi, does anyone know to read and parse a comma delimited file?
    Should I use StreamTokenizer, StringTokenizer, or the oro RegEx packages?
    What is the best?
    I have a file that has several lines of data that is double-quoted and comma delimited like:
    "asdfadsf", "asdfasdfasfd", "asdfasdfasdf", "asdfasdf"
    "asdfadsf", "asdfasdfasfd", "asdfasdfasdf", "asdfasdf"
    Any help would be greatly appreciated.
    thanks,
    Spack

    import java.util.*;
    import java.io.*;
    public class ResourcePortalParser
        public ResourcePortalParser()
        public Vector tokenize() throws IOException
          File reportFile = new File("C:\\Together5.5\\myprojects\\untitled2\\accessFile.txt");
         Vector tokenVector = new Vector();
          StreamTokenizer tokenized = new StreamTokenizer(new FileReader(reportFile));
         tokenized.eolIsSignificant(true);
              while (tokenized.nextToken() != StreamTokenizer.TT_EOF)
                   switch(tokenized.ttype)
                        case StreamTokenizer.TT_WORD :
                        System.out.println("Adding token - " + tokenized.sval);
                             tokenVector.addElement(tokenized.sval);
                             break;
              return tokenVector;
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Why my Firefox v6.02 browser always open *.csv (comma delimited) file in another tab rather than downloading a file? I do not have right click option to save this file.

    My Firefox v6.02 browser always open *.csv (comma delimited) file in another tab rather than downloading a file? I do not have right click option to save this file. My OP is windows XP sp2.

    Hi mha007,
    Go to this site "http://www.nseindia.com/content/indices/ind_histvalues.htm"
    Select any Index type and from dates select just one day or any number of days. Click "Get Details" button. This will open tabular data on loaded page (with link CSV file link at bottom).
    When I click this link, it opens CSV file in new tab (in Firefox browser) and does not open download window (just as in case of other file formats like *.zip, *.rar or *.xls).
    Right-click of link does not give "save as" or "save file" option.
    Firefox is my preferred and default browser.
    ========
    surprisingly, When I do same thing in IE6 browser, data-table page shows 2 options below table, i.e. (1) download file (2) open file.

  • Error while importing a text file for a list of values

    Hi Experts,
    While importing a text file for a list of values in designer, I am getting error message as below:
    "Invalid setting in Excel key of the Engines section of the Windows Registry. (3433)".
    I am using BO XI R3. Universe Designer version : 12.1.0.882
    Any suggestion ?
    Regards

    plzzzzzzzzzzzzzzzzz.............sme1 help me out

  • Back reference for regular expressions on "Search & Replace".

    Can't I reference a result from my Regular Expression used on "Search Clause" into my "Replace Clause"?
    What I'm doing is:
    Using JDev 10.1.3 DP,
    Search Menu -> Replace in Files...
    Select "Regular Expressions"
    Text: (A[0-9]*?_)(.)
    Replace with: $2 (reference to the second Parenthesis in the "Text" Field).
    For example, in Java, I would so something like this:
    "Dummy String".replaceAll("(D.*? )(S)", "$2");
    Are there any other ways that I can just Search something and Replace for nothing? I need a simple "Search and Delete", you know?
    If I don't do that and try to leave it blank, a warning comes up saying that the "Replace with" field cannot be blank.
    Any sugestions?

    BOUNCE!
    Please, anyone?
    Will I really have to delete 1200 occurrences by hand???
    :(

  • Import Format for Separte Debit and Credit Columns (comma delimited file)

    I have a file that is comma delimited with a sparate debit column and a separate credit column:
    Sample:
    Ent,Acct,description,Dr,Cr
    ,1000,test,100,
    ,110010,another test,,100
    My import format is this:
    Comma delimited
    Field Number Number of Fields Expression
    Entity 1 5 SGB_ABC
    Account 2 5
    Amount 5 5 Script=DRCRSplit_Comma_Del.uss
    I've tried writing the following script to pull the amount from the debit column into the credit column but it just skips the lines with no amount in field 5.
    'Declare Variables
    Dim Field4
    Dim Field5
    'Retrieve Data
    Field4 = DW.Utilities.fParseString(strRecord, 4, 4, ",")
    Field5 = DW.Utilities.fParseString(strRecord, 5, 5, ",")
    'If Field4 has a value then fld 5 is to equal fld 4.
    If IsNumeric(Field5) Then
    Field5 = Field5
    Else
    Field5 = Field4
    End If
    'Return Result into FDM
    SQFLD5 = Field5
    End Function
    Can anyone tell me what I am doing wrong?
    Thanks!

    I got it to work using this script:
    Function DRCR_Comma_Del(strField, strRecord)
    'Hyperion FDM DataPump Import Script:
    'Created By:     testuser
    'Date Created:     7/22/2009 9:31:15 AM
    'Purpose: If Amount is in the DR column move it to the CR amount column.
    Dim DR
    Dim CR
    DR = DW.Utilities.fParseString(strRecord, 5, 4, ",")
    CR = DW.Utilities.fParseString(strRecord, 5, 5, ",")
    If IsNumeric(DR) Then
    strField = DR
    Else
    strField = "-" & CR
    End If
    DRCR_Comma_Del = strField
    End Function

  • Regular Expressions, include and exclude xml-files

    Hi!
    I have a javaprogram that should read xml-files from a directory. The program could contain several types of files but it should only read files with a certain pattern.
    The file names will look like this:
    "resultset_27_23.xml"
    where the numbers will change, but the rest of the file name is the same (resultset_XX_XX.xml).
    But in the same directory it will also be files with the following pattern:
    "resultset_27_23_attachment1.xml"
    Here, the numbers could change in the in the same way as the files above, and the number after the text (attachment) could also differ from file to file.Those files should not be read by the program.
    I have tried to write a regular expression pattern that only reads the first file types, and exlcudes the other ones, but it won�t work.
    Does anyone have a solution to my problem? It is possible to use either just one pattern, or two patterns; one for the files that should be included, and one for the files that should be excluded.

    So you only want files that match resultset_XX_XX.xml? Will the numbers always be two digits each? Assuming so:
    "^resultset_\\d\\d_\\d\\d.xml$"Depending which methods you use, the ^ and $ may or may not be necessary.
    If that's not what you meant, please clarify.

  • Howto create a powershell script to search the C drive for any *.pst files and copy them to a single directory

    I have a bunch of people who are saving their pst files all over the place. how do I write a script that does the following
    searches the C:\ drive for *.pst and copies them all the E:\pstfiles

    Hi,
    How about using below command:
    Move-Item c:\*.pst E:\pstfiles -force
    For more details about move-item, I would like suggest you use get-help command:
    get-help move-item
    In addition:
    Using the Move-Item Cmdlet
    http://technet.microsoft.com/en-us/library/ee176910.aspx
    Regards,
    Yan Li
    Yan Li
    TechNet Community Support

Maybe you are looking for

  • PS Issue Business Area and Profit Center - differing in WBS to Network

    Hi my team has used COPY NETWORK option and copied a network under WBS in Project Builder (CJ20N), It has observed that org elements of WBS and Network, Acticity are differing. Now there are thounds of records of the same, (Org Elements differing in

  • Use of function

    I have a table with this records: linknumber history 110 46,57,89 220 50 330 22 440 10,12 I want to have this result: rownumber linknumber history 1 110 46 2 110 57 3 110 89 4 220 50 5 330 22 6 440 10 7 440 12 and I have this function for split(camma

  • Group by for one column

    there is a scenario in informatica..where we can select more than one rows and group by on only one row..its possible in informatica.. so can any one tell how to sql for those type of scenarios For example there are SEQUENCE_ID NUMBER NOT NULL, SAT_I

  • Getting while Installing 11.5.10.2 on OEL 5 update 3 64 bit

    Hi, Can one help to install 11.5.10.2 on OEL5 64 bit. i got below error while installing apps side. runProcess_8 Creating link for iAS ORACLE_HOME/6iserver pointing to 8.0.6 Home runProcess_9 Statusstring Registering iAS ORACLE_HOME with OUI inventor

  • Apple Trailers won't play after update to Snow Leopard

    I recently upgraded from Tiger to Snow Leopard and the only glitch I have encountered is that Apple Trailers will not play. The computer screen darkens and the movie viewer screen pops up, but the viewer screen remains black and no movie appears. I h