| Date: | Tue, 10 Jun 2003 16:43:24 -0500 |
| Reply-To: | Rodney Sparapani <rsparapa@MCW.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Rodney Sparapani <rsparapa@MCW.EDU> |
| Organization: | Medical College of Wisconsin, Milwaukee |
| Subject: | Re: Removing line numbers in LOG? |
| Content-Type: | text/plain; charset=us-ascii; format=flowed |
SAS User wrote:
>on Fri, Jun 06, 2003 at 04:39:35PM -0700, David L. Cassell (cassell.david@EPAMAIL.EPA.GOV) wrote:
>
>
>>SAS User <sasuser@GUILDENSTERN.DYNDNS.ORG> sagely suggested:
>>
>>
>>> sed -ne '/^[0-9][0-9]*/s/...........//p' < foo.log > foo.sas
>>>
>>>
>> perl -pe "s/^\d+!?//" < foo.log > foo.sas
>>
>>
>>
>>>This misses 'CARDS' and 'DATALINES' statements, and may include
>>>additional autoexec lines.
>>>
>>>
>>This has similar flaws, but does tear off the annoying "!" when a
>>line runs long.
>>
>>And it can be done in SAS V9, using the prx___ functions.
>>
>>I just couldn't resist,
>>
>>
Somehow I missed the beginning of this thread. But, assuming no malicious
snippage, I don't see how those regexps could possibly do it. I've copied
the code for ess-sas-transcript from ESS below. Notice that the regexp is
12 lines long (also note that emacs lisp requires backslashes to be pluralized):
(defun ess-sas-transcript (&optional strip)
"Comment .log messages to create a .sas program; use C-u to strip."
(interactive "P")
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp (concat
"^\\(\\(1[ \t]+The SAS System\\| \\|NOTE\\|WARNING\\|ERROR\\|"
"[ \t]+\\(\\(real\\|cpu\\) time\\|Licensed to\\|Engine:\\|"
"Physical Name:\\|File Name=\\|Pipe command=\\|"
"RECFM=[DFNPV],LRECL=\\|[0-9]+:[0-9]+[ /t]+[0-9]+:[0-9]+\\|"
"[1-9][0-9]* at [0-9]+:[0-9]+[ /t]+[1-9][0-9]* at [0-9]+:[0-9]+\\)\\).*$"
"\\|[0-9]+\\([ \t]+!\\)?\\|MPRINT([_A-Z]+):\\|"
"[ \t]+\\(values at the places given by: (Line):(Column).\\|"
"The m\\(in\\|ax\\)imum record length was [1-9][0-9]*.\\|"
"One or more lines were truncated.\\|"
"Each place is given by: (Number of times) at (Line):(Column).\\|"
"[0-9][0-9]:[0-9][0-9] [MTWFS][aeioudhnrst]+day, [JFMASOND]"
"[aeiouybcghlmnprstv]+ [1-9][0-9]?, 20[0-9][0-9]\\)\\)")
nil t) (replace-match (if strip " " "/*\\&*/") t))
))
--
Rodney Sparapani Medical College of Wisconsin
Sr. Biostatistician Patient Care & Outcomes Research
rsparapa@mcw.edu http://www.mcw.edu/pcor
Was 'Name That Tune' rigged? WWLD -- What Would Lombardi Do
|