• 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. Copy a particular line of text file to a new file using...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 17151
  • 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

Copy a particular line of text file to a new file using SKILL

jarilak
jarilak over 10 years ago

Hi....

I have one text file.From that file, i need to copy some set of lines to a new file.For this copying, i need to read each & every line of the text file and compare them with some reference lines.Is there any keywords or SKILL function available in SKILL.? Can anyone help me......?

Thanks & regards 

Jarilak.r

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Sjoerd, thanks for your suggestion. I'd not noticed that all the lines that Jarilak had wanted were those with a result count of other than 0. Of course, we're still guessing what Jarilak actually wants to do!

    Jarilak, this goes to show the importance of clearly stating what you want. In fact the first step of writing any program is to identify what it should do - i.e. defining the algorithm. The actual step of converting that algorithm into a specific language is secondary. If you can't state the algorithm clearly in English (or in a pseudo-langauge) first, there's little hope of implementing it in SKILL.

    If indeed you wanted all the lines with Total Result Count != 0 then I would do something like:

    pattern=pcreCompile("TOTAL Result Count =")
    inp=infile("./input.txt")
    outp=outfile("./output.txt")
    when(inp && outp
      while(gets(line inp)
        when(pcreExecute(pattern line) && atoi(car(last(parseString(line))))!=0  ; check line matches and has the last token being non-zero
          fprintf(outp "%s" line)
        )
      )
      close(inp)
      close(outp)
    )

    Please be more precise in your questions next time - whilst I understand that people are new to a programming language, that doesn't mean that it's OK to ask poorly framed questions where it requires guesswork to work out what you want. It's easier in those circumstances to just ignore the question and focus on something where a more precise question has been asked, given that we're all volunteers and have limited spare time.

    Kindest regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Sjoerd, thanks for your suggestion. I'd not noticed that all the lines that Jarilak had wanted were those with a result count of other than 0. Of course, we're still guessing what Jarilak actually wants to do!

    Jarilak, this goes to show the importance of clearly stating what you want. In fact the first step of writing any program is to identify what it should do - i.e. defining the algorithm. The actual step of converting that algorithm into a specific language is secondary. If you can't state the algorithm clearly in English (or in a pseudo-langauge) first, there's little hope of implementing it in SKILL.

    If indeed you wanted all the lines with Total Result Count != 0 then I would do something like:

    pattern=pcreCompile("TOTAL Result Count =")
    inp=infile("./input.txt")
    outp=outfile("./output.txt")
    when(inp && outp
      while(gets(line inp)
        when(pcreExecute(pattern line) && atoi(car(last(parseString(line))))!=0  ; check line matches and has the last token being non-zero
          fprintf(outp "%s" line)
        )
      )
      close(inp)
      close(outp)
    )

    Please be more precise in your questions next time - whilst I understand that people are new to a programming language, that doesn't mean that it's OK to ask poorly framed questions where it requires guesswork to work out what you want. It's easier in those circumstances to just ignore the question and focus on something where a more precise question has been asked, given that we're all volunteers and have limited spare time.

    Kindest regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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