![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Grep question. | saurabhsinha23 | UNIX for Dummies Questions & Answers | 3 | 12-11-2007 01:58 AM |
| grep question | tim-bobby | UNIX for Dummies Questions & Answers | 4 | 10-05-2007 11:58 AM |
| Question about GREP | Adriel | UNIX for Dummies Questions & Answers | 16 | 03-22-2007 08:03 AM |
| Another grep question | kingdbag | UNIX for Dummies Questions & Answers | 6 | 10-27-2006 01:56 AM |
| Grep question | eloquent99 | UNIX for Dummies Questions & Answers | 4 | 02-20-2003 10:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
grep & sed question
I'm trying to write a bash script to perform a tedious task, but I have no experience and hardly any knowledge so I've been having a rough time with it.
I'm on Mac OS X, and I want a script to do the following: I have a directory that has about 200 sudirectories. In each of these directories, there are a number of html files that each include a relative link to an image. What I want to do is create one html file that contains all the img tags of all the html files in all the sudirectories. I would also like to turn all the relative links into absolute ones (meaning: I want each src attribute to contain the full path on my system of the html file -and image, they are in the same directory-). I've been at it with sed, but one of the problems seems to be that some of the html files don't have regular UNIX line endings, so it's kind of hard for me to extract just those line with img files (I get the full files), let alone img tags. What I've been toying with is the following (where you'll see that I try to put some line endings back where I think they'd be useful - though for some reason it doesn't work as expected): #!/bin/bash for pic in ./advanced/*/image??.html do grep img $pic | sed "s/img/img\ /" | cat >> images.html done This script doesn't address the absolute link problem yet. Any help would be greatly appreciated. Last edited by der Kopf; 11-20-2004 at 05:00 AM.. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|