Re: Put ID at beginning of data lines

Werfgam Nadler <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Hello,

Sorry for the previous mail. I misread ur requirement. But heres the code, i have now.
Should work for all sed because i did not use "\n"  at all.


cat x.sed

# Begin of x.sed
$d; N;

/\
\"/!{
s/^\(.*\)\
\(.*\)$/\1,\2\
\1/;
P;
}
D;
# End of x.sed



Here is the output

"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",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",89861384,107281037











________________________________
 From: Eliana <[email protected]>
To: Werfgam Nadler <[email protected]>; sed-users <[email protected]> 
Sent: Friday, May 18, 2012 7:20 AM
Subject: Re: Put ID at beginning of data lines
 
> Hello,
> another way (without using the hold
> space).
> cat x.sed
> N
> /\n\"/!{
> s/^\(.*\)\n/\n\1/;
> D
> }
> P;
> D
> thanks
> nadler

Thank you, sorry for the delay.  Unfortunately,  my sed  does not recognize the \n as a newline, so this will not work for me.  I did try it, and it  did not produce the desired results at all.  But I was able to use the suggestions of others to help me process my data and pipe the data back and forth between sed and tr, to produce the desired results, and I am quite happy.

At some point before the year is over, I may have a more up to date operating system and be able to try this on that with a newer sed, but for now, I have to be content with doing some fiddling around outside of sed to produce the final desired results. 

I only  asked the list  for help with the attachment of IDs to data lines, as I could handle the other code myself, switching variables around and recoding and standardizing some of the content.   I have put all of what I need into a shell script that automates an awkward set of multiple calls using awk, sed, and tr, but gives a file that now has exactly what I need.  

Thanks again,
Eliana

[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.