Shell programming

Hi,

Iam new to shell program,

I want to check a file which is having same lines 2 times and i want to display it in a seperate file.

File format is :

AQWERTYU|1234567890
ASDFGHJK|0987654321
ZXCVBNML|1098576453
AQWERTYU|1234567890

I need to take the 1st and 4th lines in the above file and write it in to seperate file.
Please help me.

Thanks in advance

sorry i need to take 1st and 4th line in the above file.

Try this one

for i in `uniq -d filename`
do
grep $i b
done > result.temp

Here what is b in the given sample code ...Pls help me??

# sort file | uniq -D
AQWERTYU|1234567890
AQWERTYU|1234567890

Thanks a lot.. .it is working fine.