Another lame 'vi' question......


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Another lame 'vi' question......
# 1  
Old 09-11-2006
MySQL Anyone lame 'vi' question......

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

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 Smilie

Last edited by Yinzer955i; 09-11-2006 at 02:24 PM.. Reason: too tired to type
# 2  
Old 09-11-2006
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
# 3  
Old 09-11-2006
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 04:02 PM..
# 4  
Old 09-11-2006
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!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. What is on Your Mind?

Protocol Jokes (Lame)

I have a UDP joke but i don't know if you will get it: Also, I have a TCP joke and i know you will get it. :) (2 Replies)
Discussion started by: TUX servers
2 Replies

2. Shell Programming and Scripting

Help with 'batch conversion using lame' shell script

Hi. I am trying to write an sh script that will: 1. take each wav file in ~/Documents 2. convert each into mp3 format using "lame" encoder 3. save the new mp3 in ~/Documents/newmp3s. It has to follow the 3 steps in this order for each wav file before taking the next file. I tried a... (8 Replies)
Discussion started by: Kingzy
8 Replies

3. Shell Programming and Scripting

Delete original wav file if lame was successful encoding.

In a bash script: src=”cooltrack.wav” dst=”cooltrack.mp3” lame $src $dst I would like to add some line that would delete the source wav file like: rm $src but I would like this only if the encoding was successful. What should I include before deleting the original to check that the... (2 Replies)
Discussion started by: Aia
2 Replies

4. Shell Programming and Scripting

lame php question

When do PHP variables/objects vanish? Say, I have a database structure in index.php, I called connect(). Then I sent the user another page, say index2.php. Should I create a fresh database structure and call connect() again, or is there a way around this? (6 Replies)
Discussion started by: rayne
6 Replies

5. Solaris

lame question

i have one stupid question... so please don't laught at me :-) actually i have linux on my pc, but i want to install a solaris... i heard that solaris is not free, but my friend said that there is a free solaris dostridution in gnu licence... is it real? if yes where can i get it? if no -... (4 Replies)
Discussion started by: pgas
4 Replies
Login or Register to Ask a Question