script help
Knight
knightotp at gmail.com
Mon Aug 23 12:11:14 UTC 2010
On Mon, 2010-08-23 at 12:45 +0100, Hakan Koseoglu wrote:
> On 23 August 2010 12:38, kosaidpo <kosaidpo at gmail.com> wrote:
> >>> Can someone help me with a script/grep syntax please? I have a string within an HTML file downloaded by wget.
> > grep ( your path here) ( patter you lookin for)
> The grep syntax is the other way around.
> grep [options] PATTERN [FILE...]
> grep [options] [-e PATTERN | -f FILE] [FILE...]
> --
> Hakan (m1fcj) - http://www.hititgunesi.org
>
Try:
$ cat testfile | egrep "Antivirus Pattern" | cut -d " " -f 5 | cut -c 2-
| tr -d '.'
Result:
xyyyz
xyyzz
xyyyz
xyyzz
Explanation:
1) cat your file
2) egrep a pattern (regular expression mode of grep one could also use
regular grep in this case)
3) cut --delimter = space, cut everything except field 5
4) cut everything before second character and show till end of line.
When there's bogus data behind the string make it looks like: cut -c 2-8
5) tr -d removes the dots
Greetings,
--
Knight Of The Post
Linux Pro or Pro Linux?!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100823/25940493/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100823/25940493/attachment.sig>
More information about the ubuntu-users
mailing list