Re: Put ID at beginning of data lines

Jim Hill <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <CAEE75_1GB+ufsk0r_-rVXHas2O9sVLZDQVaXwaYHwPbBuhzjBg@mail.gmail.com>
On Mon, May 14, 2012 at 6:57 PM, Jan FRS <[email protected]> wrote:

> **
> $ sed -ne '/^"/h;/^[^"]/{G;s/\([0-9,]\+\
> )\n\(.*\)/\2,\1/p}' data.1
>
> That'll simplify some:

$ sed -r '/^"/{h;d}; G;s/(.*)\n(.*)/\2,\1/' test.txt
"1","V3","Johnny Jamison",144058604,149864828
"1","V3","Johnny Jamison",144058604,149864828
"1","V3","Johnny Jamison",104132262,115218852
"1","V3","Johnny Jamison",40739561,80546082
"2","V2","Janet Anne Doe",145956371,150258170
"2","V2","Janet Anne Doe",145956371,150258170
"2","V2","Janet Anne Doe",125505743,131005138
"2","V2","Janet Anne Doe",53487753,77418759
"2","V2","Janet Anne Doe",32142804,34367848
"3","V2","William Jones",121742874,124782881
"3","V2","William Jones",121742874,124782881
"3","V2","William Jones",89861384,107281037
$


[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.