Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I am not an Economist. I am an honest man! -- Paul McCracken


devel / comp.lang.lisp / script solution in common lisp

SubjectAuthor
o script solution in common lispRobert L.

1
script solution in common lisp

<su9m83$1tus$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16835&group=comp.lang.lisp#16835

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!uUJbdg9jyTZ/MaHEmaRA4g.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: script solution in common lisp
Date: Sun, 13 Feb 2022 01:17:57 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <su9m83$1tus$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="63452"; posting-host="uUJbdg9jyTZ/MaHEmaRA4g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Sun, 13 Feb 2022 01:17 UTC

Pascal Bourguignon wrote:

> gavino <gavcomedy@gmail.com> writes:
>
> > I have a file named movie1.
> > name1,500
> > name2,yellow
> >
> > I want to write a program/script that reads the value from the file
> > next to a name, with 1 comma in between.

....

> > For a number it will test if x > 400.
> > For the string it will test if sting = green
> > If the test fails, the result should be a file named movie.error with
> > the name,value pairs that FAIL in the test.

....

> (with-open-file (movie.error "movie.error" :direction :output
> :if-exists :append
> :if-does-not-exist :create)
> (loop
> :for line = (read-line *standard-input* nil nil)
> :while line
> :do (let ((comma (position #\, line)))
> (when comma
> (let* ((name (subseq line 0 comma))
> (vfield (subseq line (1+ comma)))
> (value (or (ignore-errors (parse-integer vfield
> :junk-allowed nil))
> vfield)))
> (unless (if (integerp value)
> (> value 400)
> (string= value "green"))
> (format movie.error "~A,~A~%" name value)))))))

awk -F, "!(($2~/^ *green *$/) || (/[0-9] *$/ && ($2>400)))" junk.txt

--- Input file ---
name1,500
name2, yellow
name3, 300
name4,green
name5, green
name6, 500
name7,yellow-green

--- Output ---
name2, yellow
name3, 300
name7,yellow-green


devel / comp.lang.lisp / script solution in common lisp

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor