[vox-tech] Using awk or perl to find and replace

Ken Bloom kabloom at ucdavis.edu
Tue Nov 23 23:36:27 PST 2004


On Tue, Nov 23, 2004 at 10:33:56PM -0800, Trevor M. Lango wrote:
> I have been reading the man pages and I'm lost. ?I want to scan through 
> an input file for an expression with this pattern:
> 
> ? ? h.*.JPG
> 
> and replace it with an expression with the following pattern:
> 
> ? ? *.h.JPG
> 
> Perl and awk both appear to be ideal candidates for just such a task 
> but I'm a serious newbie to both of 'em. ?Any help much appreciated!

sed -e 's/h\.\(.*\)\.jpg/\1.h.jpg/g'

--Ken Bloom

-- 
I usually have a GPG digital signature included as an attachment.
See http://www.gnupg.org/ for info about these digital signatures.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://ns1.livepenguin.com/pipermail/vox-tech/attachments/20041123/9779b457/attachment.bin


More information about the vox-tech mailing list