The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-02-2006
Terrible
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Desperately Need Help On This Perl script

ok, i dont know any perl. actually, very very little. not much at all.

now, the task i have is that i have to go into a directory that is packed with hundreds of files that contains lots of strings of which i have to filter through. so when i get into this directory, i type:

grep -r akamai * in the directory.


the above grep command spits out series of output similar to the below:

/excite/homepagepoll/ans_jan24_02.oft: <IMG SRC="http://a88.g.akamai.net/f/88/606/1d/image.lovesluudf.com/people/images/global/poll/popuptop.gif" WIDTH="468" HEIGHT="62" BORDER="0">


the path to the left of the colon of the above output represents the absolute path to the file in which the string i wanted is found.

now, my task is, i have to write a Perl script that will filter through the result of the "grep -r akamai *" and then produce a line that only contains the filename and the akamai string.

meaning, the resulting output should be something similar to:

/excite/homepagepoll/ans_jan24_02.oft: http://a88.g.akamai.net/f/88/606/1d/...l/popuptop.gif

basically, something that greps out the filename and the just the link(s) that is contained in that file which matches the "akamai"

sorry for the long read. but i just needed to clarify. someone please help. all i need is just something to get started with.