The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
lame php question rayne Shell Programming and Scripting 6 08-23-2006 04:41 AM
lame question pgas SUN Solaris 4 02-20-2004 08:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-11-2006
Registered User
 

Join Date: Aug 2006
Posts: 15
Thumbs up Anyone lame 'vi' question......

This is a long shot, but there are many bright folks on here

My next vi drama involves a using a prototype file for a makefile. I have an old prototype file but its not in correct format. It's formated as:

/the/old/path/file1 <garbage> <garbage>
/the/old/path/file2 <garbage> <garbage>
.
.

I'm trying to format it into:
f none /the/old/path/file1=../../the/old/path/file1 777 user group

I've made a copy of the old file, removed <garbage> and whitespaces, and got everything I need left of the "=". Now I'm looking for a quick way to get the right side of the "=" formated correctly.

Any help is appreciated

Last edited by Yinzer955i; 09-11-2006 at 10:24 AM. Reason: too tired to type
Reply With Quote
Forum Sponsor
  #2  
Old 09-11-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
This would be easier with sed but I got this to work in vim and I think that it will work in plain old vi:

:%s+\(/.*\)=+\1=../..\1 777 user group+

It will certainly work in sed:

sed 's+\(/.*\)=+\1=../..\1 777 user group+' < inputfile > outputfile
Reply With Quote
  #3  
Old 09-11-2006
Registered User
 

Join Date: Aug 2006
Posts: 15
It replied "Substitute pattern match failed."....but it's start...

I forgot to mention the all the files end with .src, but their names vary.

So for example....

65000.src
65010.src
.
.
.


Thanks.

edit: Gonna give sed a try.......fingers crossed

Last edited by Yinzer955i; 09-11-2006 at 12:02 PM.
Reply With Quote
  #4  
Old 09-11-2006
Registered User
 

Join Date: Aug 2006
Posts: 15
Quote:
Originally Posted by Perderabo
This would be easier with sed but I got this to work in vim and I think that it will work in plain old vi:

:%s+\(/.*\)=+\1=../..\1 777 user group+

It will certainly work in sed:

sed 's+\(/.*\)=+\1=../..\1 777 user group+' < inputfile > outputfile
Thanks to one of my buddies, he was able to modify your original cmd and come up with:

sed 's+\(data.*\)+\1=../../\1 777 user group+' < inputfile > outfile

Many thanks!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0