質問編集履歴
5
混乱のないように、文章を修正しました。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            ### 前提・実現したいこと
         | 
| 2 2 |  | 
| 3 | 
            -
            例えば、下方のXMLファイルがあり、私の手元には以下の「参照用のID listファイル」があります。ID を | 
| 3 | 
            +
            例えば、下方のXMLファイルがあり、私の手元には以下の「参照用のID listファイル」があります。inputファイルとしてこのID list を使い、xml ファイル内の<Ids>に必ず記載されているIDと照合し、もし一致した場合に、その子要素として必ず一緒に記述されている特定の要素(<Attribute attribute_name="isolation_source" harmonized_name="isolation_source" display_name="isolation source">surface water</Attribute>)の</Attribute>の前のキーワード(ここではsurface water)を抽出し、元のIDとともに出力するにはどのようにすればよろしいでしょうか?linux 初心者で、またxml ファイルを扱うのも初めてで、素人の質問で申し訳ございません。記載事項に不備がございましたら、ご質問いただけましたら幸いです。【追加1】XMLファイルを処理する場合、xmllint を有効活用すべきとコメントいただきまして試行錯誤中ですが、子要素内のIDやキーワードを抽出することもできておらず、引き続き勉強中です。【追加2】XMLファイルをソースからそのままコピーしました。
         | 
| 4 4 |  | 
| 5 5 | 
             
            ●参照するID のlist ファイル
         | 
| 6 6 |  | 
4
疑問点を絞り、書式全体を修正しました。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -1,47 +1,42 @@ | |
| 1 1 | 
             
            ### 前提・実現したいこと
         | 
| 2 2 |  | 
| 3 | 
            -
            例えば、下方の | 
| 3 | 
            +
            例えば、下方のXMLファイルがあり、私の手元には以下の「参照用のID listファイル」があります。ID を照合しながら、xml ファイル内に必ずあるIDを検索し、その子要素として一緒に必ず記述されている特定の要素(<Attribute attribute_name="isolation_source" harmonized_name="isolation_source" display_name="isolation source">surface water</Attribute>)の</Attribute>の前のキーワード(ここではsurface water)を抽出し、元のIDとともに出力するにはどのようにすればよろしいでしょうか?linux 初心者で、またxml ファイルを扱うのも初めてで、素人の質問で申し訳ございません。記載事項に不備がございましたら、ご質問いただけましたら幸いです。【追加1】XMLファイルを処理する場合、xmllint を有効活用すべきとコメントいただきまして試行錯誤中ですが、子要素内のIDやキーワードを抽出することもできておらず、引き続き勉強中です。【追加2】XMLファイルをソースからそのままコピーしました。
         | 
| 4 4 |  | 
| 5 5 | 
             
            ●参照するID のlist ファイル
         | 
| 6 6 |  | 
| 7 | 
            +
            SAMN03741962
         | 
| 7 8 | 
             
            SAMN03741963
         | 
| 8 | 
            -
            SAMN03741964
         | 
| 9 9 |  | 
| 10 10 | 
             
            ●XMLファイルと照合後に出力したいlist ファイル
         | 
| 11 11 |  | 
| 12 | 
            +
            SAMN03741962^ surface water
         | 
| 12 | 
            -
            SAMN03741963^ surface water | 
| 13 | 
            +
            SAMN03741963^ surface water
         | 
| 13 | 
            -
             | 
| 14 | 
            +
             | 
| 14 15 | 
             
            *ここで「^」はタブ区切りを示しています。
         | 
| 15 16 |  | 
| 16 17 | 
             
            ### 該当のXMLファイル
         | 
| 17 18 |  | 
| 19 | 
            +
            ```XML
         | 
| 18 20 | 
             
            <?xml version="1.0" encoding="UTF-8"?>
         | 
| 19 21 | 
             
            <BioSampleSet>
         | 
| 20 | 
            -
            <BioSample access="public" publication_date="2015-11- | 
| 22 | 
            +
            <BioSample access="public" publication_date="2015-11-08T00:00:00.000" last_update="2019-06-20T17:16:02.371" submission_date="2015-05-28T09:58:39.000" id="3741962" accession="SAMN03741962">
         | 
| 21 | 
            -
            last_update="2015-11-08T06:44:46.060"
         | 
| 22 | 
            -
            submission_date="2015-05-28T09:58:39.470" id="3741963"
         | 
| 23 | 
            -
            accession="SAMN03741963">
         | 
| 24 23 | 
             
              <Ids>
         | 
| 25 | 
            -
                <Id db="BioSample" is_primary="1"> | 
| 24 | 
            +
                <Id db="BioSample" is_primary="1">SAMN03741962</Id>
         | 
| 26 | 
            -
                <Id db_label="Sample name">BACL4 MAG- | 
| 25 | 
            +
                <Id db_label="Sample name">BACL4 MAG-120507-bin80</Id>
         | 
| 27 26 | 
             
              </Ids>
         | 
| 28 27 | 
             
              <Description>
         | 
| 29 | 
            -
                <Title>Microbe sample from  | 
| 28 | 
            +
                <Title>Microbe sample from OM182 bacterium BACL3 MAG-120507-bin80</Title>
         | 
| 30 | 
            -
            MAG-120813-bin39</Title>
         | 
| 31 | 
            -
                <Organism taxonomy_id=" | 
| 29 | 
            +
                <Organism taxonomy_id="1655577" taxonomy_name="OM182 bacterium BACL3 MAG-120507-bin80">
         | 
| 32 | 
            -
            bacterium BACL4 MAG-120813-bin39">
         | 
| 33 | 
            -
                  <OrganismName>Actinobacteria bacterium BACL4
         | 
| 34 | 
            -
            MAG- | 
| 30 | 
            +
                  <OrganismName>OM182 bacterium BACL3 MAG-120507-bin80</OrganismName>
         | 
| 35 31 | 
             
                </Organism>
         | 
| 36 32 | 
             
                <Comment>
         | 
| 37 | 
            -
                  <Paragraph>Genome assembled from metagenome sample
         | 
| 33 | 
            +
                  <Paragraph>Genome assembled from metagenome sample SAMN03351369</Paragraph>
         | 
| 38 | 
            -
            SAMN03351393</Paragraph>
         | 
| 39 34 | 
             
                </Comment>
         | 
| 40 35 | 
             
              </Description>
         | 
| 41 36 | 
             
              <Owner>
         | 
| 42 37 | 
             
                <Name>Kungliga Tekniska Hogskolan, Science for Life Laboratory</Name>
         | 
| 43 38 | 
             
                <Contacts>
         | 
| 44 | 
            -
                  <Contact email=" | 
| 39 | 
            +
                  <Contact email="luisa.hugerth@scilifelab.se">
         | 
| 45 40 | 
             
                    <Name>
         | 
| 46 41 | 
             
                      <First>Luisa</First>
         | 
| 47 42 | 
             
                      <Last>Hugerth</Last>
         | 
| @@ -55,72 +50,47 @@ | |
| 55 50 | 
             
              </Models>
         | 
| 56 51 | 
             
              <Package display_name="Microbe; version 1.0">Microbe.1.0</Package>
         | 
| 57 52 | 
             
              <Attributes>
         | 
| 58 | 
            -
                <Attribute attribute_name="strain" harmonized_name="strain"
         | 
| 53 | 
            +
                <Attribute attribute_name="strain" harmonized_name="strain" display_name="strain">not applicable</Attribute>
         | 
| 59 | 
            -
            display_name="strain">not applicable</Attribute>
         | 
| 60 | 
            -
                <Attribute attribute_name="Salinity (PSU)">6. | 
| 54 | 
            +
                <Attribute attribute_name="Salinity (PSU)">6.6</Attribute>
         | 
| 61 | 
            -
                <Attribute attribute_name="depth" harmonized_name="depth"
         | 
| 55 | 
            +
                <Attribute attribute_name="depth" harmonized_name="depth" display_name="depth">2</Attribute>
         | 
| 62 | 
            -
            display_name="depth">2</Attribute>
         | 
| 63 | 
            -
                <Attribute attribute_name="env_biome"
         | 
| 64 | 
            -
            harmonized_name="env_broad_scale" display_name="broad-scale
         | 
| 56 | 
            +
                <Attribute attribute_name="env_biome" harmonized_name="env_broad_scale" display_name="broad-scale environmental context">Brackish water</Attribute>
         | 
| 65 | 
            -
            environmental context">Brackish water</Attribute>
         | 
| 66 | 
            -
                <Attribute attribute_name="collection_date"
         | 
| 67 | 
            -
            harmonized_name="collection_date" display_name="collection
         | 
| 57 | 
            +
                <Attribute attribute_name="collection_date" harmonized_name="collection_date" display_name="collection date">07-May-2012</Attribute>
         | 
| 68 | 
            -
            date">13-Aug-2012</Attribute>
         | 
| 69 | 
            -
                <Attribute attribute_name="temp" harmonized_name="temp"
         | 
| 58 | 
            +
                <Attribute attribute_name="temp" harmonized_name="temp" display_name="temperature">5.6</Attribute>
         | 
| 70 | 
            -
            display_name="temperature">18.2</Attribute>
         | 
| 71 59 | 
             
                <Attribute attribute_name="environmental-sample">TRUE</Attribute>
         | 
| 72 | 
            -
                <Attribute attribute_name="sample_type"
         | 
| 73 | 
            -
            harmonized_name="sample_type" display_name="sample type">Metagenomic
         | 
| 60 | 
            +
                <Attribute attribute_name="sample_type" harmonized_name="sample_type" display_name="sample type">Metagenomic Assembly</Attribute>
         | 
| 74 | 
            -
            Assembly</Attribute>
         | 
| 75 | 
            -
                <Attribute attribute_name="isolation_source"
         | 
| 76 | 
            -
            harmonized_name="isolation_source" display_name="isolation
         | 
| 61 | 
            +
                <Attribute attribute_name="isolation_source" harmonized_name="isolation_source" display_name="isolation source">surface water</Attribute>
         | 
| 77 | 
            -
            source">surface water</Attribute>
         | 
| 78 | 
            -
                <Attribute attribute_name="geo_loc_name"
         | 
| 79 | 
            -
            harmonized_name="geo_loc_name" display_name="geographic
         | 
| 80 | 
            -
            location">Baltic Sea</Attribute>
         | 
| 81 | 
            -
                <Attribute attribute_name=" | 
| 62 | 
            +
                <Attribute attribute_name="geo_loc_name" harmonized_name="geo_loc_name" display_name="geographic location">Baltic Sea</Attribute>
         | 
| 82 | 
            -
            display_name="latitude and longitude">56.930850 N 17.060667
         | 
| 63 | 
            +
                <Attribute attribute_name="lat_lon" harmonized_name="lat_lon" display_name="latitude and longitude">56.930850 N 17.060667 E</Attribute>
         | 
| 83 | 
            -
            E</Attribute>
         | 
| 84 64 | 
             
                <Attribute attribute_name="metagenomic">TRUE</Attribute>
         | 
| 85 65 | 
             
                <Attribute attribute_name="metagenome-source">marine metagenome</Attribute>
         | 
| 86 | 
            -
                <Attribute attribute_name="isolation-source"
         | 
| 87 | 
            -
            harmonized_name="isolation_source" display_name="isolation
         | 
| 66 | 
            +
                <Attribute attribute_name="isolation-source" harmonized_name="isolation_source" display_name="isolation source">brackish water collected from the surface of the Baltic Sea</Attribute>
         | 
| 88 | 
            -
            source">brackish water collected from the surface of the Baltic
         | 
| 89 | 
            -
            Sea</Attribute>
         | 
| 90 | 
            -
                <Attribute attribute_name="isolate" harmonized_name="isolate"
         | 
| 67 | 
            +
                <Attribute attribute_name="isolate" harmonized_name="isolate" display_name="isolate">BACL4 MAG-120507-bin80</Attribute>
         | 
| 91 | 
            -
            display_name="isolate">BACL4 MAG-120813-bin39</Attribute>
         | 
| 92 68 | 
             
              </Attributes>
         | 
| 93 69 | 
             
              <Links>
         | 
| 94 70 | 
             
                <Link target="bioproject" type="entrez" label="PRJNA273799">273799</Link>
         | 
| 95 71 | 
             
              </Links>
         | 
| 96 | 
            -
              <Status status="live" when="2015-11-08T06:44:46. | 
| 72 | 
            +
              <Status status="live" when="2015-11-08T06:44:46.013"/>
         | 
| 97 73 | 
             
            </BioSample>
         | 
| 98 | 
            -
            <BioSample access="public" publication_date="2015-11-08T06:44:46. | 
| 74 | 
            +
            <BioSample access="public" publication_date="2015-11-08T06:44:46.060" last_update="2015-11-08T06:44:46.060" submission_date="2015-05-28T09:58:39.470" id="3741963" accession="SAMN03741963">
         | 
| 99 | 
            -
            last_update="2015-11-08T06:44:46.120"
         | 
| 100 | 
            -
            submission_date="2015-05-28T09:58:39.527" id="3741964"
         | 
| 101 | 
            -
            accession="SAMN03741964">
         | 
| 102 75 | 
             
              <Ids>
         | 
| 76 | 
            +
            --
         | 
| 103 77 | 
             
              <Ids>
         | 
| 104 | 
            -
                <Id db="BioSample" is_primary="1"> | 
| 78 | 
            +
                <Id db="BioSample" is_primary="1">SAMN03741963</Id>
         | 
| 105 | 
            -
                <Id db_label="Sample name">BACL4 MAG- | 
| 79 | 
            +
                <Id db_label="Sample name">BACL4 MAG-120813-bin39</Id>
         | 
| 106 80 | 
             
              </Ids>
         | 
| 107 81 | 
             
              <Description>
         | 
| 108 | 
            -
                <Title>Microbe sample from Actinobacteria bacterium BACL4
         | 
| 82 | 
            +
                <Title>Microbe sample from Actinobacteria bacterium BACL4 MAG-120813-bin39</Title>
         | 
| 109 | 
            -
            MAG-120820-bin23</Title>
         | 
| 110 | 
            -
                <Organism taxonomy_id=" | 
| 83 | 
            +
                <Organism taxonomy_id="1655578" taxonomy_name="Actinobacteria bacterium BACL4 MAG-120813-bin39">
         | 
| 111 | 
            -
            bacterium BACL4 MAG-120820-bin23">
         | 
| 112 | 
            -
                  <OrganismName>Actinobacteria bacterium BACL4
         | 
| 84 | 
            +
                  <OrganismName>Actinobacteria bacterium BACL4 MAG-120813-bin39</OrganismName>
         | 
| 113 | 
            -
            MAG-120820-bin23</OrganismName>
         | 
| 114 85 | 
             
                </Organism>
         | 
| 115 86 | 
             
                <Comment>
         | 
| 116 | 
            -
                  <Paragraph>Genome assembled from metagenome sample
         | 
| 87 | 
            +
                  <Paragraph>Genome assembled from metagenome sample SAMN03351393</Paragraph>
         | 
| 117 | 
            -
            SAMN03351395</Paragraph>
         | 
| 118 88 | 
             
                </Comment>
         | 
| 119 89 | 
             
              </Description>
         | 
| 120 90 | 
             
              <Owner>
         | 
| 121 91 | 
             
                <Name>Kungliga Tekniska Hogskolan, Science for Life Laboratory</Name>
         | 
| 122 92 | 
             
                <Contacts>
         | 
| 123 | 
            -
                  <Contact email=" | 
| 93 | 
            +
                  <Contact email="luisa.hugerth@scilifelab.se">
         | 
| 124 94 | 
             
                    <Name>
         | 
| 125 95 | 
             
                      <First>Luisa</First>
         | 
| 126 96 | 
             
                      <Last>Hugerth</Last>
         | 
| @@ -134,47 +104,30 @@ | |
| 134 104 | 
             
              </Models>
         | 
| 135 105 | 
             
              <Package display_name="Microbe; version 1.0">Microbe.1.0</Package>
         | 
| 136 106 | 
             
              <Attributes>
         | 
| 137 | 
            -
                <Attribute attribute_name="strain" harmonized_name="strain"
         | 
| 107 | 
            +
                <Attribute attribute_name="strain" harmonized_name="strain" display_name="strain">not applicable</Attribute>
         | 
| 138 | 
            -
            display_name="strain">not applicable</Attribute>
         | 
| 139 108 | 
             
                <Attribute attribute_name="Salinity (PSU)">6.2</Attribute>
         | 
| 140 | 
            -
                <Attribute attribute_name="depth" harmonized_name="depth"
         | 
| 109 | 
            +
                <Attribute attribute_name="depth" harmonized_name="depth" display_name="depth">2</Attribute>
         | 
| 141 | 
            -
            display_name="depth">2</Attribute>
         | 
| 142 | 
            -
                <Attribute attribute_name="env_biome"
         | 
| 143 | 
            -
            harmonized_name="env_broad_scale" display_name="broad-scale
         | 
| 110 | 
            +
                <Attribute attribute_name="env_biome" harmonized_name="env_broad_scale" display_name="broad-scale environmental context">Brackish water</Attribute>
         | 
| 144 | 
            -
            environmental context">Brackish water</Attribute>
         | 
| 145 | 
            -
                <Attribute attribute_name="collection_date"
         | 
| 146 | 
            -
            harmonized_name="collection_date" display_name="collection
         | 
| 111 | 
            +
                <Attribute attribute_name="collection_date" harmonized_name="collection_date" display_name="collection date">13-Aug-2012</Attribute>
         | 
| 147 | 
            -
            date">20-Aug-2012</Attribute>
         | 
| 148 | 
            -
                <Attribute attribute_name="temp" harmonized_name="temp"
         | 
| 112 | 
            +
                <Attribute attribute_name="temp" harmonized_name="temp" display_name="temperature">18.2</Attribute>
         | 
| 149 | 
            -
            display_name="temperature">18.4</Attribute>
         | 
| 150 113 | 
             
                <Attribute attribute_name="environmental-sample">TRUE</Attribute>
         | 
| 151 | 
            -
                <Attribute attribute_name="sample_type"
         | 
| 152 | 
            -
            harmonized_name="sample_type" display_name="sample type">Metagenomic
         | 
| 114 | 
            +
                <Attribute attribute_name="sample_type" harmonized_name="sample_type" display_name="sample type">Metagenomic Assembly</Attribute>
         | 
| 153 | 
            -
            Assembly</Attribute>
         | 
| 154 | 
            -
                <Attribute attribute_name="isolation_source"
         | 
| 155 | 
            -
            harmonized_name="isolation_source" display_name="isolation
         | 
| 115 | 
            +
                <Attribute attribute_name="isolation_source" harmonized_name="isolation_source" display_name="isolation source">surface water</Attribute>
         | 
| 156 | 
            -
            source">surface water</Attribute>
         | 
| 157 | 
            -
                <Attribute attribute_name="geo_loc_name"
         | 
| 158 | 
            -
            harmonized_name="geo_loc_name" display_name="geographic
         | 
| 159 | 
            -
            location">Baltic Sea</Attribute>
         | 
| 160 | 
            -
                <Attribute attribute_name=" | 
| 116 | 
            +
                <Attribute attribute_name="geo_loc_name" harmonized_name="geo_loc_name" display_name="geographic location">Baltic Sea</Attribute>
         | 
| 161 | 
            -
            display_name="latitude and longitude">56.930850 N 17.060667
         | 
| 117 | 
            +
                <Attribute attribute_name="lat_lon" harmonized_name="lat_lon" display_name="latitude and longitude">56.930850 N 17.060667 E</Attribute>
         | 
| 162 | 
            -
            E</Attribute>
         | 
| 163 118 | 
             
                <Attribute attribute_name="metagenomic">TRUE</Attribute>
         | 
| 164 119 | 
             
                <Attribute attribute_name="metagenome-source">marine metagenome</Attribute>
         | 
| 165 | 
            -
                <Attribute attribute_name="isolation-source"
         | 
| 166 | 
            -
            harmonized_name="isolation_source" display_name="isolation
         | 
| 120 | 
            +
                <Attribute attribute_name="isolation-source" harmonized_name="isolation_source" display_name="isolation source">brackish water collected from the surface of the Baltic Sea</Attribute>
         | 
| 167 | 
            -
            source">brackish water collected from the surface of the Baltic
         | 
| 168 | 
            -
            Sea</Attribute>
         | 
| 169 | 
            -
                <Attribute attribute_name="isolate" harmonized_name="isolate"
         | 
| 121 | 
            +
                <Attribute attribute_name="isolate" harmonized_name="isolate" display_name="isolate">BACL4 MAG-120813-bin39</Attribute>
         | 
| 170 | 
            -
            display_name="isolate">BACL4 MAG-120820-bin23</Attribute>
         | 
| 171 122 | 
             
              </Attributes>
         | 
| 172 123 | 
             
              <Links>
         | 
| 173 124 | 
             
                <Link target="bioproject" type="entrez" label="PRJNA273799">273799</Link>
         | 
| 174 125 | 
             
              </Links>
         | 
| 175 | 
            -
              <Status status="live" when="2015-11-08T06:44:46. | 
| 126 | 
            +
              <Status status="live" when="2015-11-08T06:44:46.060"/>
         | 
| 176 127 | 
             
            </BioSample>
         | 
| 128 | 
            +
            ```
         | 
| 177 129 |  | 
| 130 | 
            +
             | 
| 178 131 | 
             
            ### 試したこと
         | 
| 179 132 |  | 
| 180 | 
            -
            grep | 
| 133 | 
            +
            grep、sed、xpath による抽出
         | 
3
xmllint の使用について追加しました。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ### 前提・実現したいこと
         | 
| 2 2 |  | 
| 3 | 
            -
            例えば、下方のような XMLファイルがあり(処理したいデータ形式が生物のDNA 情報の登録形式に非常に似ているため、それを活用)、ここで表示させている以降も同様の形式でデータが格納されているとします。私の手元には以下の通り「accession IDだけ」の情報がありますが、これを照合しながら、xml ファイル内にあるID を検索し、そのID がもつ特定の要素の二つ(例えばXML内のAttributes 内にある <Attribute attribute_name="isolation_source" harmonized_name="isolation_source" display_name="isolation source">surface water</Attribute> と <Attribute attribute_name="metagenome-source">marine metagenome</Attribute>)の情報をタブ区切りで付与して出力するにはどのようにすれば、よろしいでしょうか?linux 初心者で、またxml ファイルを扱うのも初めてで、素人の質問で申し訳ございません | 
| 4 | 
            -
             | 
| 3 | 
            +
            例えば、下方のような XMLファイルがあり(処理したいデータ形式が生物のDNA 情報の登録形式に非常に似ているため、それを活用)、ここで表示させている以降も同様の形式でデータが格納されているとします。私の手元には以下の通り「accession IDだけ」の情報がありますが、これを照合しながら、xml ファイル内にあるID を検索し、そのID がもつ特定の要素の二つ(例えばXML内のAttributes 内にある <Attribute attribute_name="isolation_source" harmonized_name="isolation_source" display_name="isolation source">surface water</Attribute> と <Attribute attribute_name="metagenome-source">marine metagenome</Attribute>)の情報をタブ区切りで付与して出力するにはどのようにすれば、よろしいでしょうか?linux 初心者で、またxml ファイルを扱うのも初めてで、素人の質問で申し訳ございません。記載事項に不備がございましたら、ご質問いただけましたら幸いです。【追加】XMLファイルを処理する場合、xmllint を有効活用すべきとコメントいただきまして、これでの処理方法をご教示いただけましたら幸いです。
         | 
| 4 | 
            +
             
         | 
| 5 5 | 
             
            ●参照するID のlist ファイル
         | 
| 6 6 |  | 
| 7 7 | 
             
            SAMN03741963
         | 
2
抽出したい要素を明確にしました。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            ### 前提・実現したいこと
         | 
| 2 2 |  | 
| 3 | 
            -
            例えば、下方のような XMLファイルがあり(処理したいデータ形式が生物のDNA 情報の登録形式に非常に似ているため、それを活用)、ここで表示させている以降も同様の形式でデータが格納されているとします。私の手元には以下の通り「accession IDだけ」の情報がありますが、これを照合しながら、xml ファイル内にあるID を検索し、そのID がもつ特定の要素の二つ(例えばXML内のAttributes 内にある isolation | 
| 3 | 
            +
            例えば、下方のような XMLファイルがあり(処理したいデータ形式が生物のDNA 情報の登録形式に非常に似ているため、それを活用)、ここで表示させている以降も同様の形式でデータが格納されているとします。私の手元には以下の通り「accession IDだけ」の情報がありますが、これを照合しながら、xml ファイル内にあるID を検索し、そのID がもつ特定の要素の二つ(例えばXML内のAttributes 内にある <Attribute attribute_name="isolation_source" harmonized_name="isolation_source" display_name="isolation source">surface water</Attribute> と <Attribute attribute_name="metagenome-source">marine metagenome</Attribute>)の情報をタブ区切りで付与して出力するにはどのようにすれば、よろしいでしょうか?linux 初心者で、またxml ファイルを扱うのも初めてで、素人の質問で申し訳ございませんが、まずは長くなってもlinux のコマンドで処理できればと思い、grep やsed を使いながら抽出を試みているものの、うまく実装できない状況が続いております。記載事項に不備がございましたら、ご質問いただけましたら幸いです。
         | 
| 4 4 |  | 
| 5 5 | 
             
            ●参照するID のlist ファイル
         | 
| 6 6 |  | 
1
質問事項の isolation source を isolation-source に修正しました。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            ### 前提・実現したいこと
         | 
| 2 2 |  | 
| 3 | 
            -
            例えば、下方のような XMLファイルがあり(処理したいデータ形式が生物のDNA 情報の登録形式に非常に似ているため、それを活用)、ここで表示させている以降も同様の形式でデータが格納されているとします。私の手元には以下の通り「accession IDだけ」の情報がありますが、これを照合しながら、xml ファイル内にあるID を検索し、そのID がもつ特定の要素の二つ(例えばXML内のAttributes 内にある isolation | 
| 3 | 
            +
            例えば、下方のような XMLファイルがあり(処理したいデータ形式が生物のDNA 情報の登録形式に非常に似ているため、それを活用)、ここで表示させている以降も同様の形式でデータが格納されているとします。私の手元には以下の通り「accession IDだけ」の情報がありますが、これを照合しながら、xml ファイル内にあるID を検索し、そのID がもつ特定の要素の二つ(例えばXML内のAttributes 内にある isolation-source と metagenome-source)をタブ区切りで付与して出力するにはどのようにすれば、よろしいでしょうか?linux 初心者で、またxml ファイルを扱うのも初めてで、素人の質問で申し訳ございませんが、まずは長くなってもlinux のコマンドで処理できればと思い、grep やsed を使いながら抽出を試みているものの、うまく実装できない状況が続いております。記載事項に不備がございましたら、ご質問いただけましたら幸いです。
         | 
| 4 4 |  | 
| 5 5 | 
             
            ●参照するID のlist ファイル
         | 
| 6 6 |  | 
