[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] Another S&R query



In message <04686bbf56.Alan.Adams@xxxxxxxxxxxxxxxxxxxxxx>
          Alan Adams <alan@xxxxxxxxxxxxxxxx> wrote:


>FredFred0175423245789
>BillMany876542335778
>Joe FJoe F3457y89567268
>
>I want to remove the first part of the line IF it is duplicated 
>immediately afterwards.
>
>In the above, remove Fred from line 1, and Joe F from line 3.

Yes. Use this Lua script

#!lua
for line in io.lines (arg[1]) do
 print ((line:gsub ("^(%D*)(%1%d.*)$", "%2")))
end

It presumes that the repeated prefix contains no digits and that
the postfix to be retained starts with a digit.
-- 
Gavin Wraith (gavin@xxxxxxxxxxxxxxx)
Home page: http://www.wra1th.plus.com/

-- 
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://diy.Torrens.org/RO/StrongED/index.html