Tuesday, March 29, 2011

How to specify control characters in sed

Sometimes you might have to process data, using sed, that has control characters like ^A or ^B. Following is how you do that

The following command echo's a string with ^B and will replace ^B by "|"
echo -e "Tiger^BLepo" | sed 's/\x02/|/g'