script help

Tom H tomh0665 at
Wed Aug 25 15:55:16 UTC 2010

On Tue, Aug 24, 2010 at 1:02 PM, Tim H. <bizdev at> wrote:
>> Can someone help me with a script/grep syntax please? I have a string
>> within an HTML file downloaded by wget.
>> The string is "Antivirus Pattern - Win vx.yyy.z"
>> I need to find that string and then pass "xyyyz" to the console pass to
>> the next command in the chain (note the lack of v and the ".").
>> Any ideas how I can do this ?
> IMHO after you have the string "Antivirus Pattern - Win vx.yyy.z" and
> you are confident it is always in that pattern you could pipe your
> initial command through this (I echo'd the initial output to represent
> your command):
> % echo "Antivirus Pattern - Win vx.yyy.z"|awk '{print$5}' | tr -d '.' |
> cut -c 2-
> xyyyz

First you don't need the echo (just like the cat that someone else had
proposed). I think that it is more of an aesthetic than a
processor/memory use issue these days...

awk '{print$5}' "Antivirus Pattern - Win vx.yyy.z" | tr -d '.' | cut -c 2-
will fail in the same way that the earlier egrep solution did.

More information about the ubuntu-users mailing list