* mark [2006.11.15 16:00]:
> I want to change the order off these three
>
> 1=red
> 2=blue
> 3=orange
>
> into
>
> 3=orange
> 2=blue
> 1=red
>
> Suggestions ?
You don't specify the overall structure of the
file, but if these 3 lines are separated by blank
lines (say), and unless you need the interactivity
of vim, I would use another tool.
% awk 'BEGIN { RS=""; FS="\n"; OFS="\n" } \
{ print $3,$2,$1 "\n"; }' << EOF
1=red
2=blue
3=orange
1=red
2=blue
3=orange
EOF
3=orange
2=blue
1=red
3=orange
2=blue
1=red
The separator can be something other than a blank
line too. As long as there is a recognizable
structure, why not take advantage of it?
--
JR