Need Help with Change Last, First to First Last

2006-10-29 Thread Mike Blonder

Hi.

I want to reorder variable2 and variable3 from the following line  
structure for 44 lines in a datafile, the data field separator is a  
(( character


variable1 data((variable2 data((variable3 data((variable4 data 
((variable5 data((variable6 data((variable7 data((variable8 data 
((variable9 data(( .. (( (end of line.  some lines have upwards to 20  
or more variables)


to

variable1 data((variable3 data((variable2 data(( etc

when I use the following syntax (which I extrapolated from sec 12.2  
of VIM manual, version 6.3):


6,50s;\(variable2.*\)((;\(variable3.*\);\2\1;

variable3 data is correctly moved into the position formerly held  
by variable2 data.  However, variable2 data is appended to the  
end of the entire line and NOT moved to the position that was  
formerly taken by variable3 data


Any ideas as to what's wrong?

Thanks

Mike



Re: Need Help with Change Last, First to First Last

2006-10-29 Thread Mike Blonder

Thanks, it works perfectly.

Can you explain:

why you changed .* to .

and the function of

{-}

Thanks

Mike

On Oct 29, 2006, at 10:27 AM, Yegappan Lakshmanan wrote:


Hi,

On 10/29/06, Mike Blonder [EMAIL PROTECTED] wrote:

Hi.

I want to reorder variable2 and variable3 from the following line
structure for 44 lines in a datafile, the data field separator is a
(( character

variable1 data((variable2 data((variable3 data((variable4 data
((variable5 data((variable6 data((variable7 data((variable8 data
((variable9 data(( .. (( (end of line.  some lines have upwards to 20
or more variables)

to

variable1 data((variable3 data((variable2 data(( etc

when I use the following syntax (which I extrapolated from sec 12.2
of VIM manual, version 6.3):

6,50s;\(variable2.*\)((;\(variable3.*\);\2\1;



Try using the following command:

:6,50s;\(variable2.\{-}\)((\(variable3.\{-}\)((;\2((\1((

- Yegappan



variable3 data is correctly moved into the position formerly held
by variable2 data.  However, variable2 data is appended to the
end of the entire line and NOT moved to the position that was
formerly taken by variable3 data

Any ideas as to what's wrong?

Thanks

Mike






Running a Set of Commands from a File

2006-08-31 Thread Mike Blonder
Hi.

I have saved a file called 'commands.'  This file has all of the
commands (g /foobar/,/goobar/ d, etc) I need to edit some very large
files.  I want to 'run' this commands file from within each of the large
files that I need to edit.  

1) do I have to chmod 'commands' as an executable?
2) can I invoke the file from within VIM?, if yes, then what is the
syntax?
3) would it be better to run it from the shell? (Linux/SuSE)

Thanks

Mike




Using args argdo to change many files regarding a pattern spanning 3 lines

2006-04-16 Thread Mike Blonder
Hi.

I am unable to successfully use args  argdo to change many files for a
specific pattern that spans 3 lines.  The files are .htm files.

I have used set listchars=:tab-,trail:- to reveal the tabs within the
file and have included what I take to be precisely the pattern within
the argdo statement:

argdo %s/\/tr^Mtd valign=middle
height=22font size=1\nbsp;img src=\/images\/arrowright.gif
border=0 alt=[0-9][0-9][0-9][0-9]\nbsp;a
href=\/What_is_New.htmWhat's New?\/a\/font\/td^M//ge | update

The [0-9][0-9][0-9][0-9] represents 4 digits that are in each iteration
of the line but 4 digits that change from file to file.  The ^Ms are
properly expresses with at ctrl V ctrl M sequences.  

Am I missing, perhaps an end of line character?

Any suggestions on this would be appreciated as I will shortly have to
change lots and lots of files for specific patterns spanning several
lines, albeit with a unique sequence within the pattern that varies from
file to file.

Thanks

Mike