How to offset carriage in $write function in verilog [closed] - verilog

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I would like to print using a built-in $write() function in verilog vcs on the same line twice, where the second write starts at a specified character position beginning from the column 0. Is it even possible? The pseudo-code would be something like:
$write("Hello world"); // Assuming printed from a new line
$write("Test",10); // Starts printing on the same line at 10th position from the beginning
The output console would look like:
Hello worlTest

You need to know the proper ASCII escape sequences for the terminal the output is going to. And not all terminal windows support the same codes or this feature at all. For example see the Move Cursor commands for the vt-100.
Other than that, you can manipulate a string before printing it.

Related

Assign a value to a variable which has =," [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I want to print the line which has below value in my text file(ex: file.txt).
I have tried multiple ways but no luck. Can someone please help me the right command.
selector="((Source IN ('VPS','VPSLegacy')) OR (JMS_TIBCO_SENDER='rig'))"
Please note that i need to use entire above value to check in the file.
The easiest way to assign a literal (potentially containing quotes or other shell syntax) to a variable, even though it comes with a performance penalty, is to use a quoted heredoc:
content=$(cat <<'EOF'
selector="((Source IN ('VPS','VPSLegacy')) OR (JMS_TIBCO_SENDER='rig'))"
EOF
)
echo "Value is: <$content>"
...correctly emits as output:
Value is: <selector="((Source IN ('VPS','VPSLegacy')) OR (JMS_TIBCO_SENDER='rig'))">

I have a text file that i want to find and delete (replace with nothing) a part that is similar but not the same [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a text file with thousands of this code below which is almost identical apart from it has a different id number. I want to find and delete all instances of this code but I do not know how to do this as find and replace requires the text to be identical. How can I do this? And what text editor on a mac can do this? Eg:
<br><a target='_blank' href='http://example.com/home/details/indexid/1101372'>Read More</a>
<br><a target='_blank' href='http://example.com/home/details/indexid/1101337'>Read More</a>
Use any text editor that allows you regular expression replace. E.g. Sublime Text.
Then do replace with <br><a target='_blank' href='http:\/\/example\.com\/home\/details\/indexid\/\d+'>Read More<\/a>

How to remove only comments from this code snippet using vim? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to remove all comments from the following code snippet using vim. Please help me in this.
int main()
{
Computer compute;
// To create an 'instance' of the class, simply treat it like you would
// a structure. (An instance is simply when you create an actual object
// from the class, as opposed to having the definition of the class)
compute.setspeed ( 100 );
// To call functions in the class, you put the name of the instance,
// a period, and then the function name.
cout<< compute.readspeed();
// See above note.
}
:g/<Pattern>/d
It will delete all lines which match the <Pattern>. e.g.
:g/\s*\/\//d
will delete all lines which has first two non-whitespace character as //.
There is several way to do this.
The easiest is probably to use a plugin like NERDCommenter http://www.vim.org/scripts/script.php?script_id=1218
If you don't want to install things, then you can use the visual mode:
- Ctrl + V to get into column visual mode
- Select the //
- then x
You can also use a macro with qa then delete the // of the first line, close the recording with q, and replay the macro with #a.
Finally, if you are a regex fan, then you can do this : :g/\s*\/\//d

Error in shell script and how to write to a file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am writing a shell script that is extracting the data from a command:
I have tried running the script in both the vi and vim editor. But everything in vain.
Please help me out. And how write the output of this in a file.
It may be noted that this is just a starting point so the script will produce multiple files so
I cannot write:
Script_name > filename
I think this question is fine now, the input file is good enough after edit, I can fully understand what you ask for now.
With awk, you need learn to use 2-d array, it will simplify the code.
awk 'BEGIN{print "Instance id Name Owner Cost.centre"}
/TAG/{split($0,a,FS);a[4]=tolower(a[4]);$1=$2=$3=$4="";b[a[3],a[4]]=$0;c[a[3]]}
END{for (i in c) printf "%-18s%-26s%-14s%-20s\n",i,b[i,"name"],b[i,"owner"],b[i,"cost.center"]}' file
Instance id Name Owner Cost.centre
i-e1cfc499 Memcached
i-7f4b9300 Test_LB01_Sachin
i-c4260db8 Rishi_Win_SAML Rishi Pandey
i-fb5ca283 CLIQR-DO NOT TOUCH mataa 1234

How to print text messages into console [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
When I compile and run example programs from OpenGL SuperBible under Linux no console window is created and as a result I can't see any text messages. Here by text messages I mean the output of printf function. This does happen under Windows - running exe opens a console window alongside the rendering window and all text messages appear in that console window.
How to I get console message printed into terminal window under Linux?
Run it in a terminal window, you'll then see the output.
If you don't see any output, check out the command line options (you'll probably have to pass -h or --helpor something as argument).

Resources