ほとんどの回答が言うように、おそらくリテラル tab char は最高です。
info sed 「\t は移植できません。」と言っています。 " :
...
'\CHAR'
Matches CHAR, where CHAR is one of '$', '*', '.', '[', '\', or '^'.
Note that the only C-like backslash sequences that you can
portably assume to be interpreted are '\n' and '\\'; in particular
'\t' is not portable, and matches a 't' under most implementations
of 'sed', rather than a tab character.
...
sed を使用するだけです i コマンドを正しく:
some_command | sed '1i\
text text2'
ここで、「text」と「text2」の間にタブがあります。 MacOS X (10.7.2) では、おそらく他の BSD ベースのプラットフォームでは、以下を使用できました:
some_command | sed '1i\
text\ttext2'
と sed \t を翻訳しました タブに。
sed の場合 \t を解釈しません また、コマンド ラインでタブを挿入するのは問題です。エディタでシェル スクリプトを作成し、そのスクリプトを実行してください。
bash の場合 (他のシェルも動作する可能性があります):
some_command | sed $'1itext\ttext'
Bash は \t などのエスケープを処理します 、 $' ' 内 引数として sed に渡す前に。