I wanted to create a script that I could check .xhtml files for images and add alt tags if needed.  While searching I found regular expressions and did man on glob but I'm unsure on where or what to search within awk and sed.  What would be the best option to do the following:<img class=something width=something height=something src=folder/folder/image.png /><img id=something src=folder/folder/file.png />I wanted the desired script to detect if an alt= is present if not alt the file name.  End desired format:<img class=something width=something height=something src=folder/folder/image.png alt=image/><img id=something src=folder/folder/file.png alt=file/>I know it can be done but Im not sure where to read about it.  Find <img with the ending />Within img tag detect alt=if alt= is not present record name before file type and insert into 
globbing, sed, or awk html files
sed;awk;html
One way using perl with the help of the XML::Twig parser:#!/usr/bin/env perluse strict;use warnings;use XML::Twig;use File::Spec;my $twig = XML::Twig->new(    twig_handlers => {        ## For each 'img' tag execute following function...        'img' => sub {            ## If it doesn't have an 'alt' attribute...            if ( ! $_->att_exists( 'alt' ) ) {                 ## Get value of 'src' tag.                my $src = $_->att( 'src' );                return unless $src;                ## Get last part of the path and remove extension.                my $src_file = (File::Spec->splitpath( $src ))[2] || q{};                $src_file =~ s/\.[^.]+$//;                ## Create the 'alt' attribute.                $_->set_att( 'alt', $src_file );            }           }       },      pretty_print => 'indented',)->parsefile( shift )->print;Run it with your xml file as unique argument, like:perl script.pl xmlfile