[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: delimiters with more than one character? ...



On Wed, Jul 15, 2020 at 10:11:08AM -0400, Bob Weber wrote:
> Which is why I showed this:
> 
> tr -s '\\\|' '\|'
> 
> which replaces \| with a single character which is known not to be in the input data and usable as a awk field separator.  It just happens to be a |

You misunderstood my point.  The | character COULD be in the input data.
So could the \ character.

What does your command do with input that contains standalone | and \
characters?

unicorn:~$ echo '| \ |\ \| |' | tr -s '\\\|' '\|'
| | | | |

The wrong thing.

The tr command is never going to be suited to identifying multi-character
delimiter strings.  It wasn't built for that.  It's simply the wrong
tool for this job.


Reply to: