• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Very fundamental- put quotation mark(s) into a string

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 145
  • Views 6451
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Very fundamental- put quotation mark(s) into a string

jorankin
jorankin over 14 years ago

I am trying to put a quotation mark into a string so that I can use a system () command to perform sed on my netlist. My netlist was modified and all of the " " 's in my netlist were removed from my .pwl file names. Now spectre won't run. Can you tell me how to do this? It is a very fundamental thing, but for some reason, it's not clear how to do this in SKILL.

Thanks,

John

  • Cancel
  • Austin CAD Guy
    Austin CAD Guy over 14 years ago

     Hi John

     Can you give an example of the sed command?

     With formatted print statements (printf, sprintf, fprintf) yuo can use a %L format that will print the string with double quotes. You can also escape the quotes with a backslash.

    Ted

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • jorankin
    jorankin over 14 years ago
    Ted,

    This doesn't really have to do with the sed command. It is more fundamental than that. I want to be able to make a string which has a " inside of it. This sounds straightforward, but it isn't. I think I figured it out. You have to put a exit character in front of the " to put it inside of a string for a system command. For example, when I do the following:
    system(strcat("echo " "\""  "test" "\""))

    Returns: test in my shell.

    Thanks,
    John
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Austin CAD Guy
    Austin CAD Guy over 14 years ago
    So you want to have it print out "test" in the shell instead of test?

    Ted

    system(strcat("echo " "\""  "test" "\""))

    Returns: test in my shell.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • jorankin
    jorankin over 14 years ago

    I want to be able to put quotation marks in a shell command.

     

    the above example wasn't a very good one since one could do the above with or without quotation marks. In the shell, to print "test", you have to do echo "\"test\"". It would be even more fun in SKILL...ugh...

     

    In my specific case, I want to take a netlist, find a specific pattern, and insert a quotation mark in front of it. At a shell terminal, I would do this with a sed command:

     

    sed 's;pattern;"pattern;' file1>file2

    mv file2 file1

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Austin CAD Guy
    Austin CAD Guy over 14 years ago

     OK, I was getting some strange things with the echo command anyways.

     I created a file with multiple lines. I wanted to the first string found on all lines to add a quote in front of it.The pattern was is

     Here is what I typed into the CIW:

    testFile = "testFile"

    pattern = "is"

     system( sprintf( cmdLine "sed 's;%s;\"%s;' %s > %s2" pattern pattern testFile testFile ))

    This sprintf is a string format command, the first argument is a symbol to hold the formatted value, it was only put in to create a debugging variable, it could have been nil.

    The format string has an escaped double quote and  4 string format statements (%s) which are filled with the values of the 4 variables which followed.

    Once it ran, I could check the formatted string by examining the value of cmdLine.

    cmdLine
    "sed 's;is;\"is;' testFile>testFile2"

    Ted

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Junior0304
    Junior0304 over 9 years ago

    thanks,

    you saved my day today..

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information