file1.txt
次の内容のファイルがあります
P0000021=Result of string 21
P0000022=Result of string 22
P0000023=Result of string 23
P0000024=Result of string 24
P0000025=Result of string 25
P0000026=Result of string 26
P0000027=Result of string 27
T1000028=Result of string 28
何らかのコマンドを使用して任意のキーを見つけ、対応する値を取得したいとします。たとえばP0000024
、出力を検索すると、
Result of string 24
私はgrep
このように使用してみました:
grep '"P0000024"=' file1.txt | cut -d'=' -f2 > result.txt
ただし、期待される結果は得られません。