Why is sed not recognizing \t as a tab?

前端 未结 11 1585
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 19:54
sed \"s/\\(.*\\)/\\t\\1/\" $filename > $sedTmpFile && mv $sedTmpFile $filename

I am expecting this sed script to insert a <

11条回答
  •  孤独总比滥情好
    2020-11-29 20:40

    I've used something like this with a Bash shell on Ubuntu 12.04 (LTS):

    To append a new line with tab,second when first is matched:

    sed -i '/first/a \\t second' filename
    

    To replace first with tab,second:

    sed -i 's/first/\\t second/g' filename
    

提交回复
热议问题