RechenW
RechenW

Reputation: 52

Remove tabs from file

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.

Upvotes: 0

Views: 1665

Answers (1)

Harald
Harald

Reputation: 5093

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"

Upvotes: 1

Related Questions