GNU bug report logs -
#38706
error
Previous Next
Full log
View this message in rfc822 format
tag 38706 moreinfo
stop
Hello,
On 2019-12-22 2:37 a.m., Garn-Bachmann wrote:
> Inserting characters at the end leads to errors
> cat ~/te.txt | sed 's|$|h|g'
> h036
> h110
> h110
I suspect this is an issue with end-of-line characters
being "\r\n" (CR LF) in the input file.
The '$' regex matches the end of the line,
which would be AFTER the "\r". The text line becomes "0036\rh\n"
which causes the output you are seeing.
For example:
$ printf '%s\r\n' aaa bbb ccc | sed 's|$|h|g'
haa
hbb
hcc
---
There are many ways to remove the carriage return (\r) characters.
For example:
Using sed:
$ printf '%s\r\n' aaa bbb ccc | sed 's|\r|| ; s|$|h|g'
aaah
bbbh
ccch
Using "tr":
$ printf '%s\r\n' aaa bbb ccc | tr -d '\r' | sed 's|$|h|g'
aaah
bbbh
ccch
Or using the "dos2unix" programs.
---
If this solves the issue - great.
If not, please share the input file (te.txt) to help us
diagnose the issue better.
You can send it to me privately off-list if you prefer.
regards,
- assaf
This bug report was last modified 5 years and 148 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.