X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Virus-Scanned: by amavisd-new (Uni-Kiel/l5ms-sc) From: geda AT psjt DOT org (Stephan =?utf-8?Q?B=C3=B6ttcher?=) To: geda-user AT delorie DOT com Subject: Re: [geda-user] Searching for refdes's having a specific attribute? References: <568F9808 DOT 5040808 AT envinsci DOT co DOT uk> <98DD4EFF-C1B7-4D51-9C99-DB0E04A99AAC AT noqsi DOT com> Date: Fri, 08 Jan 2016 16:29:30 +0100 In-Reply-To: <98DD4EFF-C1B7-4D51-9C99-DB0E04A99AAC@noqsi.com> (John Doty's message of "Fri, 8 Jan 2016 08:55:02 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u08FTcnm012028 Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk John Doty writes: > On Jan 8, 2016, at 8:20 AM, Stephan Böttcher wrote: > >> "Matt Rhys-Roberts (matt DOT rhys-roberts AT envinsci DOT co DOT uk) [via >> geda-user AT delorie DOT com]" writes: >> >>> How could I search a directory of .sch schematic sheets for components >>> that contain a specific attribute, e.g. OrderCode=1234567, please? >>> Basically, I need to fit components manually to a board, one specific >>> type at a time, to keep production neat. So I need to list them by >>> unique order code, ideally. >> >> I'd use awk >> >> $ awk '/^refdes=/{R=$0};/^value=10M/{print FILENAME, R, $0}' *.sch > > Assumes refdes comes first, which may not alway be true. True, it can be improved, like $ awk '/^refdes=/{R=$0};/^value=10M/{V=$0};/^}/ && V {print FILENAME, R, V; R=0; V=0}' *.sch That's also not perfect. If it goes into a script it can be fixed with a little effort. But what I need today is not what I need tomorrow, so I type these kind of commandlines every day. They are improved until they work and no more. And when they work, they often get '|sh' appended, to do the real job. >> CSA-Beau-F.sch refdes=R1 value=10MΩ >> CSA-Beau-F.sch refdes=R51 value=10MΩ >> eptpreamps.sch refdes=R13 value=10MΩ >> eptpreamps.sch refdes=R14 value=10MΩ >> eptpreamps.sch refdes=R15 value=10MΩ >> eptpreamps.sch refdes=R16 value=10MΩ >> hetpreamps.sch refdes=R13 value=10MΩ >> hetpreamps.sch refdes=R14 value=10MΩ >> hetpreamps.sch refdes=R15 value=10MΩ >> hetpreamps.sch refdes=R16 value=10MΩ >> >> -- >> Stephan >> >> > > John Doty Noqsi Aerospace, Ltd. > http://www.noqsi.com/ > jpd AT noqsi DOT com > > -- Stephan Böttcher Tel: +49-431-880-2508 Extraterrestrische Physik, IEAP, Leibnizstr. 11, 24118 Kiel