Would you please help me in formating the folling file.
File looks like the folloing. I want to capture, The "AC" and ID row and print $2 and $3 if the file contain "hsa_" in column three. See the result file I want at the end of this file.
-----------data----------------
AC MIPF0000001
ID mir-17
MI MI0000071 hsa-mir-17
MI MI0000072 hsa-mir-18a
MI MI0000076 hsa-mir-20a
MI MI0000095 hsa-mir-93
MI MI0000113 hsa-mir-106a
MI MI0008173 cfa-mir-106a
MI MI0008214 ssc-mir-17
MI MI0008562 ptr-mir-18b
MI MI0008579 ptr-mir-20b
//
AC MIPF0000002
ID let-7
MI MI0000001 cel-let-7
MI MI0000060 hsa-let-7a-1
MI MI0000061 hsa-let-7a-2
MI MI0000062 hsa-let-7a-3
MI MI0000063 hsa-let-7b
MI MI0000064 hsa-let-7c
MI MI0000065 hsa-let-7d
MI MI0000066 hsa-let-7e
MI MI0000067 hsa-let-7f-1
MI MI0000068 hsa-let-7f-2
MI MI0000100 hsa-mir-98
MI MI0000137 mmu-let-7g
MI MI0000138 mmu-let-7i
//
-----------Result------------
AC ID Acc Name
MIPF0000001 mir-17 MI0000071 hsa-mir-17
MIPF0000001 mir-17 MI0000072 hsa-mir-18a
MIPF0000001 mir-17 MI0000076 hsa-mir-20a
MIPF0000001 mir-17 MI0000113 hsa-mir-106a
MIPF0000002 let-7 MI0000060 hsa-let-7a-1
MIPF0000002 let-7 MI0000061 hsa-let-7a-2
.....
Thanks as always
File looks like the folloing. I want to capture, The "AC" and ID row and print $2 and $3 if the file contain "hsa_" in column three. See the result file I want at the end of this file.
-----------data----------------
AC MIPF0000001
ID mir-17
MI MI0000071 hsa-mir-17
MI MI0000072 hsa-mir-18a
MI MI0000076 hsa-mir-20a
MI MI0000095 hsa-mir-93
MI MI0000113 hsa-mir-106a
MI MI0008173 cfa-mir-106a
MI MI0008214 ssc-mir-17
MI MI0008562 ptr-mir-18b
MI MI0008579 ptr-mir-20b
//
AC MIPF0000002
ID let-7
MI MI0000001 cel-let-7
MI MI0000060 hsa-let-7a-1
MI MI0000061 hsa-let-7a-2
MI MI0000062 hsa-let-7a-3
MI MI0000063 hsa-let-7b
MI MI0000064 hsa-let-7c
MI MI0000065 hsa-let-7d
MI MI0000066 hsa-let-7e
MI MI0000067 hsa-let-7f-1
MI MI0000068 hsa-let-7f-2
MI MI0000100 hsa-mir-98
MI MI0000137 mmu-let-7g
MI MI0000138 mmu-let-7i
//
-----------Result------------
AC ID Acc Name
MIPF0000001 mir-17 MI0000071 hsa-mir-17
MIPF0000001 mir-17 MI0000072 hsa-mir-18a
MIPF0000001 mir-17 MI0000076 hsa-mir-20a
MIPF0000001 mir-17 MI0000113 hsa-mir-106a
MIPF0000002 let-7 MI0000060 hsa-let-7a-1
MIPF0000002 let-7 MI0000061 hsa-let-7a-2
.....
Thanks as always