Вопрос

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