John Smith
John Smith

Reputation: 363

Save the output result of a Java program into a file

I want to run a so called Vanity Generator on my Ubuntu VPS to generate a custom address. The problem is: You start the program with java genacc and after this you have to enter a target (the custom string you want in your generated address). So after the program starts it asks for the string and then you can't use CustomString > logfile.txt because the script would think I want to generate an address which contains CustomString > logfile.txt and that doesn't work.

1) download http://blockexplore.in/static/nemGenVanity.zip

2) unzip to your desktop

3) open a command prompt and type cd Desktop/nemGenVanity

4) then type java genacc

5) pick the target that you would like in your address

Three letter words should come really fast, four letter still quickly, five letter words might take a some minutes, six letter words might take some hours, and seven letter words will take days.

README.txt

To Run: java genacc

To compile from source: javac genacc.java

Creates accounts until it finds your target string. If someone has the > private key, they have your account. So keep it safe.

General remark on addresses:

1) All mainnet addresses start with a 'N' followed by 'A', 'B', 'C', or 'D'. So you won't find addresses that start with 'NE' or 'NN' or 'N4'.

2) The digits '0', '1', '8' and '9' are not part of base32 and therefore will not appear in any address.

Upvotes: 0

Views: 1551

Answers (3)

John Smith
John Smith

Reputation: 363

Solution:

nohup java genacc <<< "test" >> log.txt &

This will start the generator and you can escape with ctrl+x. After the program generated an address the result shows up in the log.txt

Thanks everyone.

Upvotes: 1

Jerry Oberle
Jerry Oberle

Reputation: 194

It is slightly unclear exactly how you use this from the description, so I'll cover two likely scenarios.

Case 1: The Java program genacc reads from standard input. That is, if you were to simply run it interactively, you'd type something like the following

java genacc
MyCustomAddress

followed by a control-D character (indicating "end of file" on input from a terminal), where MyCustomAddress is a line of input to the program.

If that is the case, simply use the > character on the command to write its standard output to your log file, thus:

java genacc > logfile.txt
MyCustomAddress

Case 2: If MyCustomAddress is a command line parameter to be passed into the Java program (thus, in its main(String [] args) element [0]), interactively like this:

java genacc MyCustomAddress

then simply add the redirection to the end of the command

java genacc MyCustomAddress > logfile.txt

The program will not "see" the > or the file name following. These are interpreted by the shell. Internally, the shell does magic to assign the standard output file descriptor to logfile.txt before invoking java, passing it only the MyCustomAddress parameter.

Upvotes: 1

Alex-v-s
Alex-v-s

Reputation: 187

Use a pipe?

java genacc | > logfile.txt

Upvotes: 0

Related Questions