[Rd] cat with backspace and newline characters

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 5 12:33:14 CET 2013


It is user lack-of-understanding: there is no error here.  R outputs

a
b
c
backspace
newline

How the terminal displays that is up to the terminal, which was 
unstated.  (Capture the output and look at it in a hex editor.)

For

a
b
c
backspace

a normal terminal will output the prompt and overwrite 'c'.

On 05/11/2013 10:53, Renaud Gaujoux wrote:
> Maybe it's a Linux problem:
>
>> cat("abc\b")
> ab> cat("abc\b\n")
> abc
>> sessionInfo()
> R version 3.0.2 (2013-09-25)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> Sys.info()
>                                       sysname
>                                       "Linux"
>                                       release
>                           "3.11.0-12-generic"
>                                       version
> "#19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013"
>                                      nodename
>                                       "XXXXX"
>                                       machine
>                                      "x86_64"
>                                         login
>                                      "XXXXX"
>                                          user
>                                      "XXXXX"
>                                effective_user
>                                      "XXXXX"
>>
>
>
>
>
> On 1 November 2013 19:54, Dennis Murphy <djmuser at gmail.com> wrote:
>
>> I can't reproduce the error, either:
>>
>>> cat("abc\b")
>> ab> cat("abc\b\n")
>> ab
>>>
>>> sessionInfo()
>> R version 3.0.2 (2013-09-25)
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_United States.1252
>> [2] LC_CTYPE=English_United States.1252
>> [3] LC_MONETARY=English_United States.1252
>> [4] LC_NUMERIC=C
>> [5] LC_TIME=English_United States.1252
>>
>> <package info snipped for brevity>
>>
>> Dennis
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list