Should be trivial to do in Perl (I won't provide code), but I always use sed
for jobs like these:

$ echo 'A,1,B
>
> > A,2,B
>
> > B,3,C
>
> > B,1_1,A
>
> > A,2,D
>
> > C,3_3,B
>
> > B,2_2,A
>
> > D,2_2,A' | sed 'N; s/\n/: /'
>
> A,1,B: A,2,B
>
> B,3,C: B,1_1,A
>
> A,2,D: C,3_3,B
>
> B,2_2,A: D,2_2,A
>
>
On Tue, Jul 12, 2011 at 12:44 AM, Narasimha Madineedi <simha...@gmail.com>wrote:

> Hi everyone,
>
> i have a file contains the following data.
>
> A,1,B
> A,2,B
> B,3,C
> B,1_1,A
> A,2,D
> C,3_3,B
> B,2_2,A
> D,2_2,A
>
> for example A,1,B  its a request message ,corresponding response message
> will be B,1_1,A somewhere in the file.
>
> I have to sort the file in such a manner that after each request message
> corresponding response message should follow immediatly.
>
> can u help me how to resolve this issue?
> --
> Regards,
> Narasimha Madineedi
>

Reply via email to