kshスクリプトのRTFファイルから情報を抽出する

kshスクリプトのRTFファイルから情報を抽出する

抽出する必要があるデータを含むいくつかのRTFファイルがあり、抽出を自動化しようとしています。

最初の項目を検索し、<?for-each:APXINDTL?>APXINDTLを変数としてインポートする必要があります。たとえば、

<?for-each:APXINDTL?>
LOBCODE=APXINDTL

注:抽出操作のために関連するRTFファイルを変更しないでください。

以下は、テキストエディタで開かれたRTFファイルのデータの一部です。

{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch11\stshfloch0\stshfhich0\stshfbi0\deflang1036\deflangfe1041{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f11\fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}MS Mincho{\*\falt ?l?r ??\'81\'66c};}
{\f36\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f37\fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}@MS Mincho;}{\f43\froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
{\f44\froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f46\froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f47\froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
{\f48\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f49\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f50\froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
{\f51\froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f155\fmodern\fcharset0\fprq1 MS Mincho Western{\*\falt ?l?r ??\'81\'66c};}{\f153\fmodern\fcharset238\fprq1 MS Mincho CE{\*\falt ?l?r ??\'81\'66c};}
{\f154\fmodern\fcharset204\fprq1 MS Mincho Cyr{\*\falt ?l?r ??\'81\'66c};}{\f156\fmodern\fcharset161\fprq1 MS Mincho Greek{\*\falt ?l?r ??\'81\'66c};}{\f157\fmodern\fcharset162\fprq1 MS Mincho Tur{\*\falt ?l?r ??\'81\'66c};}
{\f160\fmodern\fcharset186\fprq1 MS Mincho Baltic{\*\falt ?l?r ??\'81\'66c};}{\f403\fswiss\fcharset238\fprq2 Tahoma CE;}{\f404\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f406\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f407\fswiss\fcharset162\fprq2 Tahoma Tur;}
{\f408\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f409\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f410\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f411\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}
{\f412\fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f415\fmodern\fcharset0\fprq1 @MS Mincho Western;}{\f413\fmodern\fcharset238\fprq1 @MS Mincho CE;}{\f414\fmodern\fcharset204\fprq1 @MS Mincho Cyr;}{\f416\fmodern\fcharset161\fprq1 @MS Mincho Greek;}
{\f417\fmodern\fcharset162\fprq1 @MS Mincho Tur;}{\f420\fmodern\fcharset186\fprq1 @MS Mincho Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;
\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red153\green0\blue0;
\red255\green255\blue255;\red51\green102\blue255;}{\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 
\fs24\lang1036\langfe1041\loch\f0\hich\af0\dbch\af11\cgrid\langnp1036\langfenp1041 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af11\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\ts15\tsrowd
\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af11\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext15 \styrsid12592315 
Table Grid;}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \cf17 \sbasedon10 \styrsid7888090 t1;}}{\*\rsidtbl \rsid68623\rsid93330\rsid142644\rsid155313\rsid264633\rsid332799\rsid395766\rsid403452\rsid552508\rsid658548\rsid752845\rsid1005327\rsid1069147
\rsid1128813\rsid1132924\rsid1259231\rsid1263278\rsid1265937\rsid1277887\rsid1389294\rsid1530811\rsid1992641\rsid1992983\rsid2060146\rsid2305827\rsid2307951\rsid2376273\rsid2390373\rsid2642557\rsid2643661\rsid2710428\rsid3037929\rsid3154780\rsid3165240
\rsid3281729\rsid3372746\rsid3547853\rsid3737551\rsid3741507\rsid3753885\rsid3829847\rsid4072213\rsid4226491\rsid4288612\rsid4616716\rsid4854419\rsid4924650\rsid5053770\rsid5254552\rsid5258838\rsid5340043\rsid5404475\rsid6044786\rsid6102238\rsid6112804
\rsid6123976\rsid6163342\rsid6175147\rsid6176396\rsid6308330\rsid6711426\rsid6835337\rsid6846292\rsid6970981\rsid7105696\rsid7110264\rsid7151052\rsid7223101\rsid7232350\rsid7235566\rsid7275561\rsid7408942\rsid7501061\rsid7696868\rsid7811265\rsid7888090
\rsid7944819\rsid8063473\rsid8132570\rsid8147290\rsid8153787\rsid8155155\rsid8201906\rsid8277229\rsid8328412\rsid8473648\rsid8731090\rsid8743219\rsid8792426\rsid8936820\rsid8996299\rsid9178122\rsid9527975\rsid9586581\rsid9640140\rsid9650079\rsid9723997
\rsid9922356\rsid9962332\rsid9975339\rsid9977927\rsid10179720\rsid10237241\rsid10240078\rsid10245831\rsid10254799\rsid10361269\rsid10507318\rsid10619503\rsid10712085\rsid10713024\rsid10831958\rsid11018322\rsid11083764\rsid11218957\rsid11540745
\rsid11546310\rsid11750115\rsid11805579\rsid11809863\rsid11826673\rsid11875358\rsid11882404\rsid11994392\rsid12005958\rsid12076017\rsid12131149\rsid12197000\rsid12332670\rsid12534999\rsid12592315\rsid12740964\rsid12795344\rsid12979432\rsid13117260
\rsid13122474\rsid13177707\rsid13181432\rsid13637823\rsid13648701\rsid13767565\rsid13770139\rsid13847229\rsid14100348\rsid14107631\rsid14162819\rsid14170956\rsid14311039\rsid14314535\rsid14575510\rsid14580414\rsid14616762\rsid15143013\rsid15364511
\rsid15667675\rsid15823145\rsid15928357\rsid16085770\rsid16124471\rsid16277686\rsid16319244\rsid16410490\rsid16538325\rsid16584785\rsid16647549}{\*\generator Microsoft Word 10.0.6835;}{\info{\title GL - Journals General (180 char)}{\author essilor}
{\operator essilor}{\creatim\yr2007\mo12\dy3\hr16\min52}{\revtim\yr2008\mo2\dy22\hr9\min58}{\version16}{\edmins18}{\nofpages2}{\nofwords437}{\nofchars2404}{\*\company ESSILOR}{\nofcharsws2836}{\vern16393}{\*\password 00000000}}{\*\xmlnstbl }
\paperw16838\paperh11906\margl1418\margr1418\margt1418\margb1418\gutter0\ltrsect \deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\grfdocevents0\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180
\dghorigin1418\dgvorigin1418\dghshow1\dgvshow1\jexpand\viewkind4\viewscale65\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\rsidroot11805579 \fet0{\*\wgrffmtfilter 013f}\ltrpar \sectd \ltrsect\lndscpsxn\linex0\headery709\footery709\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sectrsid2710428\sftnbj {\*\pnseclvl1\pnucrm\pnqc\pnstart1\pnindent720\pnhang 
{\pntxta .}}{\*\pnseclvl2\pnucltr\pnqc\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnqc\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnqc\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5
\pndec\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8
\pnlcltr\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnqc\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid9962332 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1036\langfe1041\loch\af0\hich\af0\dbch\af11\cgrid\langnp1036\langfenp1041 {\rtlch\fcs1 
\ab\af36\afs32 \ltrch\fcs0 \b\f36\fs32\lang2057\langfe1041\langnp2057\insrsid4616716 \hich\af36\dbch\af11\loch\f36 AP}{\rtlch\fcs1 \ab\af36\afs32 \ltrch\fcs0 \b\f36\fs32\lang2057\langfe1041\langnp2057\insrsid5254552\charrsid15143013 
\hich\af36\dbch\af11\loch\f36  - Discoun\hich\af36\dbch\af11\loch\f36 t}{\rtlch\fcs1 \ab\af36\afs32 \ltrch\fcs0 \b\f36\fs32\lang2057\langfe1041\langnp2057\insrsid3741507 \hich\af36\dbch\af11\loch\f36 s}{\rtlch\fcs1 \ab\af36\afs32 \ltrch\fcs0 
\b\f36\fs32\lang2057\langfe1041\langnp2057\insrsid5254552\charrsid15143013 \hich\af36\dbch\af11\loch\f36  Taken and Lost Report}{\rtlch\fcs1 \ab\af36\afs32 \ltrch\fcs0 \b\f36\fs32\lang2057\langfe1041\langnp2057\insrsid8277229\charrsid15143013 
\par }{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang2057\langfe1041\langnp2057\insrsid5254552\charrsid15143013 
\par }{\field\flddirty{\*\fldinst {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang2057\langfe1041\langnp2057\insrsid5254552\charrsid15143013 \hich\af36\dbch\af11\loch\f36  FORMTEXT }{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 
\f36\fs20\lang2057\langfe1041\langnp2057\insrsid3741507 {\*\datafield 0001000000000000000011666f722d6561636820415058494e44544c0000000000153c3f666f722d656163683a415058494e44544c3f3e0000000000}{\*\formfield{\fftype0\ffownstat\fftypetxt0{\*\ffdeftext 
for-each APXINDTL}{\*\ffstattext <?for-each:APXINDTL?>}}}}}{\fldrslt {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang1024\langfe1024\noproof\langnp2057\insrsid5254552\charrsid15143013 \hich\af36\dbch\af11\loch\f36 for-each APXINDTL}}}\sectd \ltrsect
\lndscpsxn\linex0\headery709\footery709\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sectrsid2710428\sftnbj {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang2057\langfe1041\langnp2057\insrsid11882404\charrsid15143013 
\par }{\field\flddirty{\*\fldinst {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \fs20\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid332799\charrsid15143013 FORMTEXT}{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 
\fs20\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid3741507 {\*\datafield 00010000000000000554657874310015435f434f4d50414e595f4e414d455f4845414445520000000000193c3f435f434f4d50414e595f4e414d455f4845414445523f3e0000000000}
{\*\formfield{\fftype0\ffownstat\fftypetxt0{\*\ffname Text1}{\*\ffdeftext C_COMPANY_NAME_HEADER}{\*\ffstattext <?C_COMPANY_NAME_HEADER?>}}}}}{\fldrslt {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 
\fs20\lang1024\langfe1024\loch\af36\hich\af36\dbch\af0\noproof\langnp2057\insrsid332799\charrsid15143013 C_COMPANY_NAME_HEADER}}}\sectd \ltrsect\lndscpsxn\linex0\headery709\footery709\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sectrsid2710428\sftnbj 
{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang2057\langfe1041\langnp2057\insrsid11882404\charrsid15143013 
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid10713024 {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang2057\langfe1041\langnp2057\insrsid15928357\charrsid15143013 
\hich\af36\dbch\af11\loch\f36 Report Date : }{\field\flddirty{\*\fldinst {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang2057\langfe1041\langnp2057\insrsid10713024\charrsid15143013 \hich\af36\dbch\af11\loch\f36  DATE \\@ "dd/MM/yyyy HH:mm:ss" }
}{\fldrslt {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang1024\langfe1024\noproof\langnp2057\insrsid10713024\charrsid15143013 \hich\af36\dbch\af11\loch\f36 15/11/2007 12:32:11}}}\sectd \ltrsect
\lndscpsxn\linex0\headery709\footery709\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sectrsid2710428\sftnbj {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\lang2057\langfe1041\langnp2057\insrsid15928357\charrsid15143013 
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid9962332 {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \fs20\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid16319244\charrsid15143013 
Invoice Currency : }{\field\flddirty{\*\fldinst {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \fs20\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid16319244\charrsid15143013 FORMTEXT}{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 
\fs20\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid3741507 {\*\datafield 00010000000000000554657874310014435f424153455f43555252454e43595f434f44450000000000183c3f435f424153455f43555252454e43595f434f44453f3e0000000000}
{\*\formfield{\fftype0\ffownstat\fftypetxt0{\*\ffname Text1}{\*\ffdeftext C_BASE_CURRENCY_CODE}{\*\ffstattext <?C_BASE_CURRENCY_CODE?>}}}}}{\fldrslt {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 
\fs20\lang1024\langfe1024\loch\af36\hich\af36\dbch\af0\noproof\langnp2057\insrsid16319244\charrsid15143013 C_BASE_CURRENCY_CODE}}}\sectd \ltrsect
\lndscpsxn\linex0\headery709\footery709\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sectrsid2710428\sftnbj {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \fs20\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid15823145\charrsid1992641 
\par }{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \fs20\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid16319244 
\par }\trowd \irow0\irowband0\ltrrow\ts15\trgaph70\trrh624\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
\trftsWidth3\trwWidth22009\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone 
\clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth4503\clshdrawnil \cellx4395\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1275\clshdrawnil \cellx5670\clvertalt\clbrdrt\brdrnone \clbrdrl
\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth2409\clshdrawnil \cellx8079\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1377\clshdrawnil \cellx9456\clvertalt
\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth1113\clshdrawnil \cellx10569\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone 
\cltxlrtb\clftsWidth3\clwWidth1134\clshdrawnil \cellx11703\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1290\clshdrawnil \cellx12993\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat19\cltxlrtb\clftsWidth3\clwWidth1290\clcbpatraw19 \cellx14283\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 
\clcbpat19\cltxlrtb\clftsWidth3\clwWidth1290\clcbpatraw19 \cellx15573\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat19\cltxlrtb\clftsWidth3\clwWidth1290\clcbpatraw19 \cellx16863\clvertalt
\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat19\cltxlrtb\clftsWidth3\clwWidth1276\clcbpatraw19 \cellx18139\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
\brdrs\brdrw10 \clcbpat19\cltxlrtb\clftsWidth3\clwWidth1254\clcbpatraw19 \cellx19393\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat19\cltxlrtb\clftsWidth3\clwWidth1254\clcbpatraw19 \cellx20647
\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat19\cltxlrtb\clftsWidth3\clwWidth1254\clcbpatraw19 \cellx21901\pard\plain \ltrpar
\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid14100348\yts15 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1036\langfe1041\loch\af0\hich\af0\dbch\af11\cgrid\langnp1036\langfenp1041 {\rtlch\fcs1 
\af36\afs20 \ltrch\fcs0 \f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673\charrsid1992641 \cell \cell }\pard \ltrpar\qc \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid14100348\yts15 {\rtlch\fcs1 
\af36\afs20 \ltrch\fcs0 \f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673\charrsid1992641 \cell \cell \cell }\pard \ltrpar\qc \li0\ri0\widctlpar\intbl\tx742\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid14100348\yts15 {
\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673\charrsid1992641 \cell }\pard \ltrpar\qc \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid14100348\yts15 {\rtlch\fcs1 
\af36\afs20 \ltrch\fcs0 \f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673\charrsid1992641 \cell }{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673 \hich\af36\dbch\af11\loch\f36 Currency}{
\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673\charrsid1992641 \cell \hich\af36\dbch\af11\loch\f36 Inv. Amount\cell \hich\af36\dbch\af11\loch\f36 Discount Taken\cell }{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 
\f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673\charrsid11826673 \hich\af36\dbch\af11\loch\f36 Discount Loss\cell }\pard \ltrpar\qc \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid10245831\yts15 {
\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \f36\fs20\cf8\lang2057\langfe1041\langnp2057\insrsid11826673\charrsid11826673 \hich\af36\dbch\af11\loch\f36 Inv. Amount (}{\field\flddirty{\*\fldinst {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 
\fs20\cf8\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid11826673\charrsid11826673 FORMTEXT}{\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \fs20\cf8\lang2057\langfe1041\loch\af36\hich\af36\dbch\af0\langnp2057\insrsid3741507 {\*\datafield 
00010000000000000554657874310014435f424153455f43555252454e43595f434f44450000000000183c3f435f424153455f43555252454e43595f434f44453f3e0000000000}{\*\formfield{\fftype0\ffownstat\fftypetxt0{\*\ffname Text1}{\*\ffdeftext C_BASE_CURRENCY_CODE}{\*\ffstattext 
<?C_BASE_CURRENCY_CODE?>}}}}}{\fldrslt {\rtlch\fcs1 \af36\afs20 \ltrch\fcs0 \fs20\cf8\lang1024\langfe1024\loch\af36\hich\af36\dbch\af0\noproof\langnp2057\insrsid11826673\charrsid11826673 C_BASE_CURRENCY_CODE}}}\sectd \ltrsect

ベストアンサー1

unrtf生成されたテキストを使用して解析します。

variable=$( unrtf --text file.rtf | sed -n '/^for-each/{s/^[^ ]* //p;q}' )

与えられた例によれば、変数の値は文字列に設定されますAPXINDTL

このsedコマンドは、スペースで始まる最初の行のみを検索し、スペースを含むfor-eachすべてのエントリを削除します。残りの行は変数に割り当てられます。

おすすめ記事