On Mon, Aug 20, 2007 at 08:30:22AM -0400, After Hours wrote:
> I realize this is a silly request, but I've not found an answer --
> 
> I need to reverse the type of a selection.
> 
> E.g.,
> 
> 
> markstanley     needs to become  yelnatskram
> 
> and I have a long list of these.  Surely there's an easy fancy grep- 
> tastic mechanism that escapes me.

Find
(.)(.)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)

Replace
\20\19\18\17\16\15\14\13\12\11\10\9\8\7\6\5\4\3\2\1


But seriously, this isn't really something that grep is suitable for.  I
would use a filter.  Here's one in Perl that reverses each line in the
selection individually:

#!perl -pl

$_ = reverse $_;

__END__


And this one reverses the whole selection as a single entity:

#!perl -pl

BEGIN { $/ = undef }

$_ = reverse $_;

__END__


HTH,
Ronald

-- 
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to