I successfully used the curl code to download text into visual studio code. Is there a way to redirect this and save it as a text file? - macos

After using the code curl -http://www.gutenberg.org/files/1041/1041.txt
the text appeared in terminal. How do I transfer that text to a txt file in a subfolder?
I've tried using echo, but I can figure out how to get the whole text. I'm new to programming, so this is the only thing I know how to do so far.

You should try going to the subfolder where you want the file stored and then run -curl http://www.gutenberg.org/files/1041/1041.txt > output_filename.out
The > symbol directs the output to wherever the filename after the > symbol is.

Related

Run line of text in terminal from rtf file

If I have some simple text in a .rtf file (called test_file.rtf), how can I run this in terminal?
For example if I have cd Documents/Movies written in this file, I don't want to have to open the file, copy that line, paste it into terminal, then hit enter to get into the Movies folder. I just want to simply 'run' test_file.rtf and then I will be in Movies folder.
Is there a simple way to just call this without loads of ammendments to my setup or to the simple rtf file? Essentially just a word to type in to say 'run this command'?

Unable to run processing pde file in Sublime Text

I am trying to run an example file from the Hype framework in Sublime Text and when I hit Ctrl + B I get "Could not create the output folder".
Any thoughts?
Link to example code:
http://www.hypeframework.org/examples/HOscillator/example_001/index.html
Try checking your build system under Tools > Build System > Processing.
Make sure you have put the .pde file in a folder that matches it's name..
ex. myGame.pde must be in a folder called, myGame.

Block windows file

There can be "This file came from another computer and might be blocked" message in file properties.
Is there a way to block back file in windows 7?
I need this for program testing.
You have to recreate the alternate data stream for the file. The easiest way to do this is by using Notepad. Run cmd.exe and navigate to the directory that contains the file. I'll use test.txt as an example, type this command:
Notepad "test.txt:Zone.Identifier"
Double quotes required. Notepad prompts you to create a new file, click Yes. Paste or write this:
[ZoneTransfer]
ZoneId=3
Press Ctrl+S to save.

How do I Pipe Standard Error to a File in DOS (Batch File)?

How do I pipe standard error to a file in a DOS batch file? Piping using >> only pipes the standard output and the standard error still goes to the console.
Details of my issue:
I am running WinRAR via command line, in an automated daily backup. And the following example pipes WinRar's output, but not the error output which is what I want most, to winraroutput.txt:
RAR.exe a -esh -r "E:\backup.rar" "D:\*.*" >> winraroutput.txt
The issue is sometimes files are in use and when they are I want to know they were missed in the archive and record this in a .txt file next to each .rar file in case we ever have to go back. The missing files are easily replaced by reinstalling programs so it's no big deal to replace them, as long as we know they are missing. So it's just information that would be great to know, not necessary, in the time of need.
How do I output just the standard error output to the .txt file and, if possible but not necessary, leave the the regular output to the console?
Bonus points:
Bonus points if you can tell me how to delete the file if it's blank (no errors)! Asked here: How do I Detect (and Delete) a File if it is Empty using a Windows Batch File?.
Try this:
command.exe 2>file.txt
Or if you prefer not to see any errors, send it to nul:
command.exe 2>nul
This should leave std::cout on the console.

command line tool text output

I have a small command line tool and after running it, I'd like to display the text output in a way that's easy for someone to copy/paste and save it or email it to someone else.
Copy/pasting from a command prompt is not done in the standard way, so I don't want people to have to copy/paste from there. Saving the file to disk is possible, but the folder where the tool is located may not have access rights so the user would have to configure the output file location (this may be too tricky for some users).
I was thinking of launching notepad with some text in it, generated from the command line tool. Is this possible? Any other suggestions?
You can use clip.
After you have clip, which can be downloaded from the link above, you use the pipe (|) command to copy the previously executed command's output to the clipboard.
The article gives you the full explanation, but here are the basics with examples:
dir /h | clip – Copy the help manual for DIR command to the clipboard
tracert www.labnol.org | clip – Trace the path from your computer to another website – the output is automatically copied to the clipboard and not displayed on the screen.
netstat | clip - Check if your computer is connecting to websites without your knowledge.
I think your command sould receive the destination e-mail as a parameter and then after executing, your command you can have simple script/.BAT file which e-mails your text output to the user using the standard Telnet SMTP commands, like explained for example in the following page:
"http://www.yuki-onna.co.uk/email/smtp.html".
You could add an option to your program that tells it to copy its own output to the clipboard using the clipboard API. Then the user could just paste it.
I like the clip suggestion, though.

Resources