第 2 回 - フィルタ,シェルスクリプトの基礎(2)

[10/03, 2009 H.Aman]
67x27(1669bytes)    

課題 4-1

テキストファイル ex4-1.txt の中で登場する software という文字列を sed コマンドを使って *** SOFTWARE *** という文字列に置き換えて出力しなさい.

課題 4-2

課題 4-1 の答えを拡張し, 置き換え対象の文字列と置き換え後の文字列を指定できるシェルスクリプト replace.sh を作りなさい.
※シェルスクリプトの中に sed コマンドを書くときは,'s/../../g' の 先頭と末尾にある ' は必要ない: ' を付けているとうまく動かないので注意.

※実行例.
課題 4-1 で使用したファイル ex4-1.txt の内容に対して software を ########### に置き換える:

     $ bash replace.sh  ex4-1.txt  'software' '###########'
     Given the central role that ########### development plays in the delivery
     and application of information technology, managers are increasingly
     focusing on process improvement in the ########### development area. This
     demand has spurred the provision of a number of new and/or improved
     approaches to ########### development, with perhaps the most prominent
     being object-orientation (OO). In addition, the focus on process
     improvement has increased the demand for ########### measures, or metrics
     with which to manage the process. The need for such metrics is
     particularly acute when an organization is adopting a new technology
     for which established practices have yet to be developed. This
     research addresses these needs through the development and
     implementation of a new suite of metrics for OO design. Metrics
     developed in previous research, while contributing to the field's
     understanding of ########### development processes, have generally been
     subject to serious criticisms, including the lack of a theoretical
     base. Following Wand and Weber (1989), the theoretical base chosen for
     the metrics was the ontology of Bunge (1977). Six design metrics are
     developed, and then analytically evaluated against Weyuker's (1988)
     proposed set of measurement principles. An automated data collection
     tool was then developed and implemented to collect an empirical sample
     of these metrics at two field sites in order to demonstrate their
     feasibility and suggest ways in which managers may use these metrics
     for process improvement.