Re: [opensuse] AWK -- Strange chars used as separators in a CSV like file
----- Original Message ---- From: Greg Freemyer <greg.freemyer@gmail.com> On Wed, May 28, 2008 at 7:19 PM, Simon Roberts <thorpflyer@yahoo.com> wrote: [...snip snip...] If anyone cares: Out of curiosity, I tried the above. It does not work because it finds the first occurrence of ^T on a line, not the last like I needed. I may need to do this more in the future, so a vi command to do this would be useful. ----------------------------------------------------------------------------------------------------------------------- Sorry, lazy testing :( You need: :%s/^v^T[^^v^T]*$// (colon, percent, ess, slash, control-v, control-t, left bracket, CARET, control-v, control-t, right bracket, star, dollar, slash, slash In other words, replace the dot-star "absolutely anything" wildcard with a _set_ (square brackets) of "anything excluding control-t" (caret control-v control-t), repeated any number of times (star). (Or you can set minimal closures, but I forget how to do that :) HTH, Cheers, Simon "You can tell whether a man is clever by his answers. You can tell whether a man is wise by his questions." — Naguib Mahfouz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, May 29, 2008 at 6:04 PM, Simon Roberts <thorpflyer@yahoo.com> wrote:
----- Original Message ----
From: Greg Freemyer <greg.freemyer@gmail.com> On Wed, May 28, 2008 at 7:19 PM, Simon Roberts <thorpflyer@yahoo.com> wrote: [...snip snip...]
If anyone cares:
Out of curiosity, I tried the above. It does not work because it finds the first occurrence of ^T on a line, not the last like I needed.
I may need to do this more in the future, so a vi command to do this would be useful. ----------------------------------------------------------------------------------------------------------------------- Sorry, lazy testing :(
You need:
:%s/^v^T[^^v^T]*$//
(colon, percent, ess, slash, control-v, control-t, left bracket, CARET, control-v, control-t, right bracket, star, dollar, slash, slash
In other words, replace the dot-star "absolutely anything" wildcard with a _set_ (square brackets) of "anything excluding control-t" (caret control-v control-t), repeated any number of times (star).
That works perfectly. Much appreciated. I've added that to my list of tricks. I thought I knew a bit about vi, but I have not used the RE features in years, so its great of you to help me out. Greg -- Greg Freemyer Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Greg Freemyer
-
Simon Roberts