문제

We are receiving a file that is delimited into columns with tabs (\t). When there is a tab present in one of the "fields" of the file, it comes in as a special tab with two backslashes (\tab).

This is causing a problem with our ETL software, so I am wondering how to take these double backslash files out prior to processing, but the sed syntax I'm using is not working:

sed "s/$(printf \\\t)/ /g"

Any help would be greatly appreciated.

도움이 되었습니까?

해결책

Prevent the shell from interpreting the backslashes by adding sinfgle quotes and add enough backslashes for sed to work on:

sed "s/$(printf '\\\\\t')/ /g"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top