3 ms·
> tr - lets you deal with line endings, which sed can't I'm not sure what you mean by "deal with line endings", but sed can operate across multiple lines. htt
by michaelmior 8y ago
> tr - lets you deal with line endings, which sed can't
I'm not sure what you mean by "deal with line endings", but sed can operate across multiple lines.
https://www.gnu.org/software/sed/manual/html_node/Text-search-across-multiple-lines.html https://www.gnu.org/software/sed/manual/html_node/Text-searc...
- zzo38computer 8y agoMaybe is meant you can remove the carriage returns easily, in case you want only the line feed on the end of the line.
- ComputerGuru 8y agoI mean directly operating on the line ending itself. e.g. remove all lines or replace `\n` with the record separator, etc.
- jfhufl 8y agoLike so? % echo 'one\ntwo\nthree' | sed -e 's,$, four,' one four two four three four
- ComputerGuru 8y agoNo, like this: > echo ‘one\ntwo\nthree’ | tr \n \| one|two|three
- Tepix 8y agoecho -e 'one\ntwo\nthree' | sed -ze 's/\n/|/g'
- ComputerGuru 8y agoHey, thanks for teaching me that!