Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
finding and removing block of identical strings
Results 1 to 1 of 1

Thread: finding and removing block of identical strings

  1. #1

    finding and removing block of identical strings

    i have a problem in finding block of identical strings...i solved the problem in finding consecutive identical words and now i want to expand the code in order to find and remove consecutive identical block of strings...
    for example the awk code removing consecutive identical word is:
    Code:
    #!/usr/bin/awk -f
    BEGIN{
    RS="[[:space:]]+";
    ORS=""
    }
    match($0,/^([[:punct:]]*)([^[:punct:]]+)([:punct:]]*)$/,f){
    if(x != f[2])
    {
    print y$0;z = FNR
    }
    x = f[2];
    y = RT
    }
    END{
    if(z != FNR)
    print f[3]"\n"
    }
    input:
    "ana are mere mere
    mere si portocale
    ion are prune prune."

    output:
    "ana are mere si portocale
    ion are prune."

    and now i want to expand the code to do the following:
    input:
    "ana are ana are mere
    ion are prune ion are prune"

    output:
    "ana are mere
    ion are prune"

    thanks
    Last edited by cocostaec; 05-16-2011 at 03:01 PM.

Similar Threads

  1. Perl and Strings
    By paradox in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 08-04-2004, 08:28 PM
  2. strings command
    By Emooz in forum Linux - General Topics
    Replies: 1
    Last Post: 07-13-2004, 10:30 AM
  3. strings for window?
    By Blaqb0x in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 05-08-2004, 01:42 AM
  4. C++ strings error
    By Blaqb0x in forum Linux - Software, Applications & Programming
    Replies: 6
    Last Post: 05-23-2002, 03:59 PM
  5. I need help with strings in C
    By in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 12-25-2001, 12:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •