<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> </head> <body>

Ok, I give... Let me give you an example of the data I need to reformat.

Bob Smith bsmith 00001234567 01/01/1986 00:00:00
Mary Ann Doe mdoe 00001234568 01/01/1986 00:00:00 00001234563 01/01/1986 00:00:00
Gilligan Q Smith gsmith 00001234569 01/01/1986 00:00:00

 

So format is:

Name     LoginID    Token    Last Login Time (... possible extra tokens and login times)

Trouble here is this, the numbers refer to security token serial numbers (changed to protect the innocent) and the time is the last login time with that token. So, people may have multiple tokens which is why double entry in the Mary Ann above. I need to find a way to comma delimit this file and it seems the hardest part is placing the comma between the login id and the name since there was no standard imposed on the name entered. My thoughts is something along the line of an expression that searches for the 0000 in the token and steps back a space, then a word, then swaps the space ahead of that with a comma, like

s/\s(\w\s0000.*)/,$1/mg

This isnt working, it has no effect on the data at all that I can see. Any ideas would be GREATLY appreciated. Thanks!

</body> </html>

In reply to Backtracking for substitutions by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.