Tips and Tricks

Find And Replace Repeated Tolerance In Analog Folder

March 8, 2012 / 1,337 views

I always set tolerances for all passive components in the board file to 1% to make sure IPG generates all guarding possible. For testing stability, I change all resistors to 10% and capacitors to 20%. If a board has many components with the same values, chances are, the tolerance for these components are generated the same. After debugging the golden boards, many components may pass with 1% or less, but I still change them before deploying the fixture and program to CEM. It’s time consuming to go through every single component to change (which I do) the tolerance, but unix commands may help me to change them faster.

To find components have the same tolerance in the analog folder, in the shell, I’m going to find all files with tolerance 2.09, 1.26 and output all the components to a file “110ohm.txt”

cd analog

find . -exec grep -l ‘2.09, 1.26’ {} > 110ohm.txt \;

find specific tolerance     find replace compile

Now we have the file with all components and we want to change all components with tolerance ‘2.09, 1.26′ to ’10, 10’

for y in *


sed “s/2.09, 1.26/10, 10/g” “$y” > temp

mv temp “$y”


it will go and replace all files with ‘2.09, 1.26′ to ’10, 10’

Load the output file     change the file

change content     change content

change content     get basic


When it’s done, check to see if the commands really work, load a file up to see if the tolerance had been changed to 10, 10. It should do it. Now we need to compile all these files. Load the list of the files up, make sure we’re at the main directory and NOT in analog directory as before, this time I use my basic window. Get the file from analog folder, but save it in the main folder.

this screen shot is for a different file, but the idea is the same. Load the file from the main folder, we need to modify it to compile in basic.

Make sure to have a space between the number and the quote.

mod file

When all lines in the file are basic compliance ‘compile “analog/rxx”, then we can ‘get basic “110ohm.txt”

If we made mistake it will prompt, but if the basic is there, we’re safe to run, it will execute the compilation of all files in this basic window.

So, it’s done for this exact tolerance modification.


Paid Links

Only registered users can comment.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.