I am not skilled with sed, to I tried "tr" as per your suggestion. My exact
code is below. The result was removal of all digits EXCEPT the octal control
characters. Looks like tr is "translating" them before translating them
(good pun huh?).

Suggestions? Anyone know if sed can do this and, if so, could provide sample
code?  Really appreciate this. BTW, this is a file that I got from an SQL
dump from a government agency. Is it typical of SQL dumps to have such octal
code?

system(paste("cat CUST_SAT_SURVEY2.csv | tr -d \\[:digit:][:digit:][:digit:]
> /tmp/a.txt"))
d <- scan("/tmp/a.txt", what = "character", sep = ",")

Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine

15032 Hunter Court, Westfield, IN  46074

(317) 490-5129 Work, & Mobile & VoiceMail
(317) 399-1219 Skype No Voicemail please


On Mon, Nov 16, 2009 at 11:49 AM, J.R. Lockwood <lockwood@rand.org> wrote:

> you are probably much better off trying to remove these in the shell
> like with tr or sed.
>
> i typically do this on the fly in R with a call like
>
> system(paste("cat myfile.txt | tr -d WHATEVER > /tmp/a.txt"))
> d <- read.table("/tmp/a.txt")
>
>
>
> On Mon, 16 Nov 2009, Mark Kimpel wrote:
>
> > Date: Mon, 16 Nov 2009 11:42:36 -0500
> > From: Mark Kimpel <mwkimpel@gmail.com>
> > To: ess-help@stat.math.ethz.ch
> > Subject: [ESS] how to deal with octal character codes in R and/or Emacs
> >     (a bit off topic for this list I know)
> >
> > I have a problem I hope someone here can help me with. I thought about
> > posting straight to the emacs help list but the problem involves R and I
> am
> > also curious to see if it could be best addressed from within R or if
> Emacs
> > can help.
> >
> > I have a very large file of ~ half a million rows with scattered octal
> > character codes (they show up in Emacs in red with the syntax '\xxx'
> where x
> > is a number. When I try to grep or gsub on columns containing these
> octals I
> > get messages similar to "invalid multibyte string".
> >
> > I have discovered how to search for these in Emacs using C-q, but replace
> > doesn't seem to accept this. To further complicate things, I'd like to
> use
> > regular expressions to remove all of them, not just one code at a time.
> >
> > What seemed to make sense to me, and which failed, was
> >
> > M-x replace regex; C-q [0-9][0-9][0-9]
> >
> > I can't even get M-x replace regex; C-q 222 to work, even when I can
> search
> > for it.
> >
> > I"ve consulted the help lists and Friedl's "Mastering Regular
> Expressions"
> > without success.
> >
> > Does anyone know of a way for me to get rid of these characters in either
> R
> > or Emacs?
> >
> > Again, my apologies if I haven't posted on the most correct list.
> >
> > Mark
> >
> >
> > Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
> > Indiana University School of Medicine
> >
> > 15032 Hunter Court, Westfield, IN  46074
> >
> > (317) 490-5129 Work, & Mobile & VoiceMail
> > (317) 399-1219 Skype No Voicemail please
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > ESS-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/ess-help
> >
>
> J.R. Lockwood
> 412-683-2300 x4941
> lockwood@rand.org
> http://www.rand.org/statistics/bios/
>
> __________________________________________________________________________
>
> This email message is for the sole use of the intended...{{dropped:11}}

