[buug] data manipulation problem - UNIX sed/awk/perl solution???

Michael Salmon ms at formulae.org
Wed Aug 7 12:08:36 PDT 2002


On Wed, Aug 07, 2002 at 01:57:21PM -0400, Gorden-Ozgul, Patricia E wrote:
> I'm a 'database' person who enters the wonderful word of UNIX only
> occasionally.
> It usually provides a solution to any problem if one knows how to use it.
> 
> I'm in the process of converting data from one system to another.
> I have a datafile that requires manipulation.
> When observing the data in vi, while in :set list mode, each line ends with
> '$'
> 
> My problem?
> The source system truncated some lines of data, placing the '$' prematurely
> to and began a new line.  For example:
> 
> ...
> ...
> <#NAME = PUBLISHER>Random House</#NAME>
> <#NAME = AUTHOR>Smith, James; Smith, Peter; Smith, Johanna; Smith, Roberta;
> Smith, Robert; Smith, Douglas; Smith, Katherine; Smith, Denis; Smith,
> Mustafa$
> Smith, Karen; Smith, Alexander; Smith, Alexandra$
> <#NAME = TITLE>This is the Title</#NAME>$
> ...
> ...
> 
> What do I want?
> 
> ...
> ...
> <#NAME = PUBLISHER>Random House</#NAME>
> <#NAME = AUTHOR>Smith, James; Smith, Peter; Smith, Johanna; Smith, Roberta;
> Smith, Robert; Smith, Douglas; Smith, Katherine; Smith, Denis; Smith,
> Mustafa; Smith, Karen; Smith, Alexander; Smith, Alexandra$
> <#NAME = TITLE>This is the Title</#NAME>$

> Would anyone out there have code that would perform this task?

in vim do.
:g /^\([^<]\)/-1j
or
:g /^[^<]/normal kJ\1x

now how about getting me a job at that big fancy laboratory? :)

> 
> Please respond to gorden at bnl.gov.
> 
> Pat Gorden-Ozgul
> _______________________________________________
> Buug mailing list
> Buug at weak.org
> http://www.weak.org/mailman/listinfo/buug



More information about the buug mailing list