Looking to Search and Sort String Twice, though am having issues

I am inputing from an access file a test library, the files in the access file are out of alphabetical order...thus I search and sort and bring these into LV in alphabetical order.  But I am running into the issue of trying to further search and sort the second column of info via the model number:
example:
Model ............. Model #
Zetor               55
Challenger        55
Ford                55
Zetor               66
Challenger        66
Ford                 66
Zetor               45
Challenger        45
Ford                45
Zetor               96
Challenger        96
Ford                 96
Need to Return the Files as per below:
Zetor               45
Challenger        45
Ford                45
Zetor               55
Challenger        55
Ford                55
Zetor               66
Challenger        66
Ford                 66
Zetor               96
Challenger        96
Ford                 96
Attachments:
search & sort string.JPG ‏65 KB

actually in my original post I had a brain-lapse on what the final sort needed to be....
I was looking for this:
Challenger        45
Challenger        55
Challenger        66
Challenger        96 Ford                 45
Ford                 55
Ford                 66
Ford                 96
Zetor                45
Zetor                55
Zetor                66
Zetor                96
 thanks for the quick response.

Similar Messages

  • Search and replace string formatting

    Hi,
    I am trying to do a search and replace formatting of a string.
    In the example I am looking for string "PASSED" but it must also start with usbflash and some number + PASSED.
    I can't get the format to have a number from 1-99. The number of replacements should add up to 6 in this case. I have tried with \d for any number, and I also tried [1-99].
    Solved!
    Go to Solution.

    Right click on the Search And Replace String function.  There is an option to use Regular Expressions.  Then give this a try.
    EDIT: You will need to set the Replace All input to TRUE.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Match Pattern.png ‏12 KB

  • Search and replace string problems

    Hi to all,
    I have problem with Search and replace string function. It shows me a wrong Value (Number) from 15 to 100 is everything OK (15=0, 30=1, 45=2, 100=3), but after 100 ........
    Take look in VI and if you have any ideas post them please
    THX
    Igor 
    Attachments:
    indexing.vi ‏10 KB

    there will be no 15115 string, but 15 or 115 and 15 is 0, 115 is 4. Anyway, i have changed string input format and now its working THX for your help
    Attachments:
    indexing.vi ‏10 KB

  • Search and replace string function

    Hello, I am using the "search and replace string" function and it does nt seem to work consistently for me.   I am using it in a situation where I am taking an array of strings, converting this into a spreadsheet string then deleting all of the commas.  Has anyone experienced the same behavior? I have searched through other posts and found other simular faults but none of the fixes worked for this. I can post the code it needed.
    Thanks,
    Andrew

    I agree that commas are often not desirable, especially if your software should also work in countries where comma is used as a decimal seperator.
    Where are the commas coming from? Does (1) each element of the original array have one (or more), do you (2) use comma as seperator if you convert it to a spreadhseet string?
    For (1), you might just strip out the comma for each element right in the loop. For case (2) you would simply use a different separator to begin with, of course.
    Btw: you are abusing a WHILE loop as a FOR loop, because you have a fixed number of iterations. Please replace it with a FOR loop. If you use a FOR loop, LabVIEW can manage memory much more efficiently, because it can allocate the entire output array before the loop starts. For While loops, the total number of iterations is not known to the compiler. (Of course a real program would also stop the loop if an error occurs. In this case you would need to stay woth the WHILE loop. )
    Do you have a simple example how the raw array elements look like. How many commas are there?
    LabVIEW Champion . Do more with less code and in less time .

  • Search and replace strings in a file while ignoring substrings

    Hi:
    I have a java program that searches and replaces strings in a file. It makes a new copy of the file, searches for a string in the copy, replaces the string and renames the new copy to the original file, thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but searching for "Topabcd" and replacing it doesnot work because there is a match for "abcd" in a different search scenario. How can I modify the code such that if "abcd" is already searched and replaced then it should not be searched for again or rather search for "abcd" as entire string and not if its a substring of another string.
    In the below code output, all instances of "abcd" and the ones of "Topabcd" are replaced by ABCDEFG and TopABCDEF respectively, whereas according to the desired output, "abcd" should be replaced by ABCDEFG and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
              String find_productstring = "abcd";
              String replacement_productstring = "ABCDEFG";
              compsXml = new FileReader(compsLoc);
              compsConfigFile = new BufferedReader(compsXml);
              File compsFile =new File("file.xml");
              File compsNewFile =new File("file1.xml");
              BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
              while ((compsLine = compsConfigFile.readLine()) != null)
                    new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
                    out.write(new_compsLine);
                    out.write("\n");
                out.close();
                compsConfigFile.close();
                compsFile.delete();
                compsNewFile.renameTo(compsFile);
            catch (IOException e)
            //since "Topabcd" contains "abcd", which is the search above and hence the string "Topabcd" is not replaced correctly
             try
                   String find_producttopstring = "Topabcd";
                   String replacement_producttopstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
                   compsConfigFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
                   BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
                   while ((compsLine = compsConfigFile.readLine()) != null)
                         new_compsLine =compsLine.replaceFirst(find_producttopstring, replacement_producttopstring);
                         out.write(new_compsLine);
                         out.write("\n");
                     out.close();
                     compsConfigFile.close();
                     compsFile.delete();
                     compsNewFile.renameTo(compsFile);
                 catch (IOException e)
            }Thanks a lot!

    Hi:
    I have a java program that searches and replaces
    strings in a file. It makes a new copy of the file,
    searches for a string in the copy, replaces the
    string and renames the new copy to the original file,
    thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but
    searching for "Topabcd" and replacing it doesnot work
    because there is a match for "abcd" in a different
    search scenario. How can I modify the code such that
    if "abcd" is already searched and replaced then it
    should not be searched for again or rather search for
    "abcd" as entire string and not if its a substring of
    another string.
    In the below code output, all instances of "abcd" and
    the ones of "Topabcd" are replaced by ABCDEFG and
    TopABCDEF respectively, whereas according to the
    desired output, "abcd" should be replaced by ABCDEFG
    and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
    String find_productstring = "abcd";
    String replacement_productstring = "ABCDEFG";
    compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    BufferedReader(compsXml);
    File compsFile =new File("file.xml");
    File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    FileWriter("file1.xml"));
    while ((compsLine =
    compsConfigFile.readLine()) != null)
    new_compsLine
    =compsLine.replaceFirst(find_productstring,
    replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
    catch (IOException e)
    //since "Topabcd" contains "abcd", which is
    the search above and hence the string "Topabcd" is
    not replaced correctly
    try
                   String find_producttopstring = "Topabcd";
    String replacement_producttopstring =
    topstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    gFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    dWriter(new FileWriter("file1.xml"));
    while ((compsLine =
    compsLine = compsConfigFile.readLine()) != null)
    new_compsLine
    new_compsLine
    =compsLine.replaceFirst(find_producttopstring,
    replacement_producttopstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
                 catch (IOException e)
    Thanks a lot!I tried the matches(...) method but it doesnt seem to work.
    while ((compsLine = compsConfigFile.readLine()) != null)
    if(compsLine.matches(find_productstring))
         System.out.println("Exact match is found for abcd");
         new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
         else
         System.out.println("Exact match is not found for abcd");
         out.write(compsLine);
         out.write("\n");

  • Search and Replace String throwing the wrong error message with regexp?

    This came up in a LAVA thread, and I'm not sure if there's a bug here or not. When using Search and Replace string, and using a regular expression of [(G[b|i])], LabVIEW throws error -4622, "There is an unmatched parenthesis in a regular expression."  There are obviously no unmatched parenthesis in that expression, so it seems to me that the wrong error is being thrown. I'm just not sure if that's a syntactically valid regexp. The problem seems to be with nesting [ ]'s inside ( )'s inside [ ]'s. I've tried a couple of regexp resources on the Web, and one suggests it's valid, while the other seems to think it isn't.
    Message Edited by eaolson on 03-13-2007 10:33 AM
    Attachments:
    ATML_StandardUnit2.vi ‏10 KB
    regexp.png ‏5 KB

    adambrewster wrote:
    I think your regexp is invalid.
    In regexps, brackets are not the same as parentheses.  Parens are for grouping, while brackets are for matching one of a class of characters.  Brackets can not be nested.
    If the regexp is replaced with [G[bi]], there is no error, so it's not a matter of nested brackets. I couldn't find anything on the PCRE man page that forbids nested brackets specifically, but it makes sense.
    Your expression "[(G[bi])]", therefore parses as a character class which matches '(', 'G', '[', 'b', or 'i' followed by an unmatched paren, and an unmatched bracket.
    I don't believe that's the case. Replace the regexp with [(Gbi)], and the error goes away. So it's not a matter of the '(' being literal, and then encountering a ')' without a matching '('.
    daveTW wrote:
    what string exactly you want to replace? I think the round braces are not right in this case, since they mark partial matches which are given back by "match regular expression". But you don't want to extract parts of the string, you want to replace them (or delete, with empty <replace string>). So if you leave the outer [( ... )] then your RegEx means all strings with either "Gb" or "Gi".
    It's not my regular expression. A poster at LAVA was having problems with one of his (a truly frightening one), and this seemed to be the element that was causing the problem. I'm pretty sure that the originator of the regexp meant to use G(b|i), which seems like a complicated way of matching "Gb" or "Gi", if you ask me.

  • Using a variable in a Powershell search and replace string

    Hi
    a couple of days ago I posted a question about doing a search and replace with wildcards
    Search and repalce with Widcards
    I got a swift and very helpful answer but now I need to build on it.
    In a text file I wanted to replace all the text between two defined words.  the script I got was this
    $text = 'Some Server this bit of text varies Language stuff'
    $text -replace '(.*Server) .+? (Language.*)','$1 it will always say this $2'
    It works great but now I want to replace "it will always say this" with a variable and I can't figure out the correct grammar to make this happen.
    Can anyone help??
    Thanks
    Alex

    Here's one way:
    $replace = 'it will aways say this'if ( $text -match '(.*Server) .+? (Language.*)' )
    { "{0} $Replace {1}" -f $matches[1,2] }
    else { $text }
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to get numeric result from 'search and replace' string function

    hii
    i am using search and replace function to get output.my output is of form ' *X0123.3 ' .here i am replacing the term *X01 with space because i need only 23.3 as a result.but i am unable to get that out in the output indicator.i used lot of functions like string to number and so on but i am getting output as zero .can you please suggest me wt to do.i am attaching a copy of my file.
    Attachments:
    Untitled 1.vi ‏25 KB

    Your problem is the fact that you are converting it to an integer, thus loosing the fractional part. You need to use "Fract/Exp String To Number" instead and create a DBL so yor data is 23.3 instead of 23.
    You also don't need to manipulate the string if the initial part is of constant lenght. Just use the offset input as in the figure below.
    Message Edited by altenbach on 07-31-2006 07:02 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ToDBL.png ‏2 KB

  • Some water got into my iPhone4 and now the home button is having issues. Is there a fix for this?

    As the title says, my home button is having issues that started after some water got into my iPhone4. It takes about twenty attempts before it will register that I hit the home button. It is not under warranty anymore. Any help or suggestions on how to fix the problem would be appreciated. Thanks

    Take to Apple and have then check.
    If it is damage you will be charged for the replacement since the warranty does not cover damage.
    Allan

  • Java Binary Search and sorting in Java

    My program is suppose to search news articles and alphabetize all the words article individually of the text file. Right now the program alphabetizes all the words of the articles including the numbers. The text file will be located below the code. So basically i need to know how to alphabetize every articles words individually.
    //This program reads an input line from the reader put the worda into an array with a count and increases
    //the count each time a word is repeated. It then sorts the words alphabetically in the array and
    //then prints out the array. There are 4 different articles like this one in the text file
    <ID>58</ID>
    <BODY>Assets of money market mutual funds
    increased 720.4 mln dlrs in the week ended yesterday to 236.90
    billion dlrs, the Investment Company Institute said.
        Assets of 91 institutional funds rose 356 mln dlrs to 66.19
    billion dlrs, 198 general purpose funds rose 212.5 mln dlrs to
    62.94 billion dlrs and 92 broker-dealer funds rose 151.9 mln
    dlrs to 107.77 billion dlrs.
    </BODY>
    import java.util.StringTokenizer;
    import java.io.FileReader;
    import java.io.BufferedReader;
    import java.io.FileWriter;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    public class WordsFrequency
       public static void main(String[] args)
          // Initializations
          FileReader reader = null;
          FileWriter writer = null;
          // Open input and output files
          try
              reader = new FileReader("Reuters00.txt");
              writer = new FileWriter("WordsReport.txt");
          catch(FileNotFoundException e)
             System.err.println("Cannot find input file");
             System.exit(1);
          catch(IOException e)
           System.err.println("Cannot open input/output file");
           System.exit(2);
          // Set up to read a line and write a line
          BufferedReader in = new BufferedReader(reader);
          PrintWriter out = new PrintWriter(writer);
          out.println("Copied file is: Words followed by frequency");
          int count = 0;
           wordCount[] wordsArray = new wordCount[100000];
          boolean done = false;
          while(!done)
             String inputLine;
             try
                  inputLine= in.readLine();
             catch(IOException e)
                System.err.println("Problem reading input, program terminates. " );
                inputLine = null;
             if (inputLine == null)
               done = true;
         sortbyWords(wordsArray,count);
               for(int i = 0; i < count;i++)
                out.println(wordsArray.toString());
    else
                   StringTokenizer tokenizer = new StringTokenizer(inputLine);
              while(tokenizer.hasMoreTokens())
                   String token = tokenizer.nextToken();
                        int lengthofString = token.length();
                        char ch = token.charAt(lengthofString-1);
                        if(ch == '.' || ch == ',' || ch == '!' || ch == '?' || ch == ';')
                   token = token.substring(0,lengthofString-1);
    wordCount wordAndCount= new wordCount(token);
                        boolean skip = false;
                        for(int i = 0; i < count; i++)
                        if(token.equalsIgnoreCase(wordsArray[i].getWord()))
                             skip = true;
                             wordsArray[i].increaseFrequency();
                        if(skip == false)
                                  wordsArray[count] = wordAndCount;
                             count++;
    // Close files
    try
    in.close();
    catch(IOException e)
    System.err.println("Error closing file.");
    finally
    out.close();
         public static void sortbyWords(wordCount [] wArray, int size)
         wordCount temp;
         for (int j = 0; j < size-1; j++)
         for (int i = 0; i < size-1; i++)
         if (wArray[i].getWord().compareToIgnoreCase(wArray[i+1].getWord()) > 0)
              temp = wArray[i];
              wArray[i] = wArray[i + 1];
              wArray[i+1] = temp;
    Edited by: IronManNY on Sep 25, 2008 3:24 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    IronManNY wrote:
    My program is suppose to search news articles and alphabetize all the words article individually of the text file. Right now the program alphabetizes all the words of the articles including the numbers. The text file will be located below the code. So basically i need to know how to alphabetize every articles words individually.You want to strip out the numbers?

  • How do I put and sort string data into an array?

    I have a txt file that has the following sample data:
    Sample.txt----
    Jones Bill 12,500 Salesperson
    Adams Frank 34,980 Manager
    Adams John 23,000 Salesperson
    Thompson Joe 59,500 Trainee
    I need to incorporate each line of data into an individual array element, while using a user-defined method
    (ex. setAllValues(String last, String first, String salary, String job)
    How do I loop the data into the array to be displayed and what is the best way to do sorts on this sample data. Any code or clues would be super helpful.
    Sanctos

    If you set up an array of Strings you can use the java.util.Arrays.sort() method to sort it. If you need to sort arbitrary Objects (i.e. your 3 strings as a whole entity) your 3-way object will have to either implement Comparable or you could write a Comparitor class to do the ordering. Not much to it, though.
    Dom.

  • Mail search and sort info

    has anyone got any good information or links on Mail sort and search?
    i am not getting results that i would expect (results are missing for all kinds of things) and i am also not finding a way to do simple things like how to search by sender as opposed to searching by term or by title. also, i am having a hard time figuring out if i can search in a particular email address etc, etc.
    i also seem to get a decent amount of crashes in Mail now that i have moved to Lion.
    TIA for any help

    23. write a summary of your post, one that's not as long, and try to be careful with those special tokens that are used for formating.
    hint: use preview button before posting, and not just press it, but also see that your message isn't odd looking[i/] in any way, for example you may have mistyped some formating token or something.
    and in your code parts, add space before or after i in [], so it would be visible, and would not mess up your code and its formating.

  • Match case in search and replace string

    Hi !
    Attached, my problem.
    I am searching "toto" in input string "toto+tototi" and replace "toto" by "A0".
    I want to "match case" the search input in order to get a string result : A0+tototi
    Does it exist options allowing to match case ?
    BR,
    Vincent
    Solved!
    Go to Solution.
    Attachments:
    MatchCase.vi ‏8 KB

    Please fill all your controls with typical strings, make the new values the default, save the VI under a new name, and attach it again.
    (This allows us to quickly reproduce your problem without entering strings and having to guess what your inputs actually are)
    WIth your given string, the result seems as expected, so we need more information on what you actually want instead.
    LabVIEW Champion . Do more with less code and in less time .

  • Search and Replace String Function replaces line feeds when I only want spaces replaced?

    I need to replace every instance of a space or series of spaces in a multi line string with commas (or tabs) so I can dump it into a spreadsheet.
    I am using the regular expresion [\s]+ and it works but it is also replacing the end of lines (\r\n) too.
    How can I make it replace the spaces but leave teh end of lines intact?
    Solved!
    Go to Solution.
    Attachments:
    replace.vi ‏6 KB

    Right click on the search string and change it to '\' Code Display. Enter the space character (\s) correctly - you've got \\s right now.

  • Search and replace string inside a column

    Hi,
    in my table there is Column A with Type NVARCHAR.
    i need to search inside all the rows in that column to find the string "_TH" and remove it wherever it exist.
    how can i do it?

    you can follow below solution .
    Step 1: Create a temporary table to load all the records which are having column with '-TH'
    Step 2 :  Use update statement and join it with temporary table to update the qualified records
    Benefits: This is a set based solution which is optimal and high perfroming
    Script:
    create table test1(col1 nvarchar(20))
    insert into test1 values('one_th'),('two_th'),('Gauri')
    --Create Temporary table
    select * 
    into #tmp2
    from Test1
    where col1 like '%_TH%'
    --update all such rows which are having column with '_TH'
    Note: I am replacing all columns with '_TH' with space . you can replace with other characters based upon your requirement.
    update t
    set col1 = replace(t.col1,'_TH','')
    from test1 t
    inner join #tmp2 t2
    on t.col1 = t2.col1
    Please comment If this solution helps you.

Maybe you are looking for

  • Hyperlinked text--the text, not the link--disappears when I create a PDF from a book in FM 11

    I am editing a FrameMaker 11 document with some text that is hyperlinked to a website. Earlier PDFs output fine. When I created the last PDF, some of the text disappeared in the PDF, but it's still visible in FM. On the PDF, the hyperlink is active i

  • Audiobook won't play from iPod

    I just downloaded an audiobook (2 files). Both files will play when I launch them from iTunes. I can see the audiobook files on my iPod (music - audiobooks), but when I play them, the file looks like it starts to play but then closes after a second a

  • Transformationstep and error handling

    Hello, SAP library says: Transformationstep -> exception exists for system error -> generated for permanent system error. My idea was: If I have an error in a mapping embedded in a transofrmation step, this should generate a system error which I can

  • Adjust yellow color on left side of Notes app in Yosemite?

    Hi all, Does anyone know how to change the ugly yellow highlighting color on left side of the Notes app in Yosemite? Thanks!

  • LR4 - No Flickr export?

    I can't seem to find a way to export to Flickr - is this supported in LR4? Running on OS X Lion Plugin Manager shows the Flickr plugin as "installed and running'. The status is enabled. When i click on "Export" in the Library section, I get the Expor