root@server:~/foo$ cat INPUT.txtlimit. Current u'^'ZOlimit. Current usage'^'FRlimit. Current us'^'ASlimit. Current usage 95 %.'^'FRlimit. Cur'^'AEWroot@server:~/foo$ sed s/limit.SOMEMAGIC/limit./g INPUT.txtlimit.'^'ZOlimit.'^'FRlimit.'^'ASlimit.'^'FRlimit.'^'AEWQuestion: how can we delete the strings ( Cur......) after limit. until the:  '  ? Searching for SOMEMAGIC :)
Delete until given character starting from given string
text processing;sed;perl
On the specific input you show, you could simply doperl -pe s/ Cur[^']*// INPUT.txt or, in sedsed s/ Cur[^']*// INPUT.txt These will simply delete a space followed by Cur and as many non-' characters as possible. If you need to do this only if the previous word was limit., use one of the other answers or:awk \$1~/limit\./{sub(/Cur[^']*/,\\,\$2)}1; INPUT.txtThere are some quoting acrobatics going on there because we need to enclose the awk scriptlet in  because we need the [^'] so the shell will expand $1 and $2 before they are passed to awk unless we escape them as \$1 and \$2.