LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-05-2003, 05:49 PM   #1
shaggz
Member
 
Registered: Dec 2002
Location: FuNkYToWN
Distribution: SuSe, Gentoo, Fedora
Posts: 64

Rep: Reputation: 15
Simple VI/Script Question


I believe this is a simple question that just has me stumped at the moment.

I am creating a new site and for some dumb reason linked all of the images to the Document root rather than the images directory. Therefore, my image tag looks like <img src="image.gif"> in all of my files. I would like to either use awk, vi, or whatever really that would get the job done to insert "images" before the .gif filename thus it would look like:
<img src="images/image.gif)


I know in VI I can use :g/image.gif/s/image.gif/newName/g
in order to do a replace however since I have many images with multiple names this would not work. I was hoping someone here might have a way to insert "images" before any .gif file.


Thanks for the help in advance!
 
Old 07-05-2003, 06:23 PM   #2
atithi
LQ Newbie
 
Registered: Jul 2003
Posts: 1

Rep: Reputation: 0
maybe this will help you:

:%s;<img src=";<img src="images/

simply type :help substitute in vim

Last edited by atithi; 07-05-2003 at 06:27 PM.
 
Old 07-05-2003, 06:55 PM   #3
shaggz
Member
 
Registered: Dec 2002
Location: FuNkYToWN
Distribution: SuSe, Gentoo, Fedora
Posts: 64

Original Poster
Rep: Reputation: 15
Thanks ALOT! Once I saw your solution it seemed so simple that I can't believe I forgot about the wildcard that would do what I needed. With what you gave me it put the *images/ literaly therefore I took that out and it work perfectly.

:%s;<img src=*;<img src=images/


The more I learn the more I love Linux.....

Thanks Again!!!

: > /mnt/windows
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple script question Elvisclone Programming 2 12-01-2004 09:13 AM
simple shell script question. strifel Programming 7 09-13-2003 01:44 PM
simple question on shell script gsbarry Linux - General 2 05-23-2003 04:09 AM
simple shell script question mathfeel Linux - General 12 03-06-2003 11:23 AM
simple date script question Cynthia Blue Programming 3 01-13-2003 03:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration