Grouping or appending the lines in a file through Unix

Hi,

I am looking for a way to Group the Lines in a file.. Basically My file structure is something like this

A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def
A 1 100 abc def
A 1 200 xyz def
A 1 300 xyz def

I need it as shown below, Its Just to Group All 1s in the 2nd field

A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 1 100 abc def
A 1 200 xyz def
A 1 300 xyz def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def

It would be really great if you can tell me a logic to regroup and remove certain unwanted or duplicate record in the 2nd occurence.. If you see above you can find that "A 1 100 abc def " is repeated twice... I would neeed an output like this

A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 1 200 xyz def
A 1 300 xyz def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def

Let me know if someone has idea on these lines

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.