batch-processing

How to store MySQL results to a file in table format

最后都变了- 提交于 2019-11-30 04:19:48
问题 I am trying to create a file and store in it the results from my query. I have a batch file that contains the single query, USE database1; SELECT * FROM table WHERE name = "abc" INTO OUTFILE output.txt; QUIT Executing this batch file using, mysql -u root -p -t -vvv < select.sql However, the result is not table formatted and fields' names are missing from the top. 100 abc Brown 32 101 abc Flair 25 102 abc McDonald 45 . . . If I remove the INTO OUTFILE statement and print the results on

PBS, refresh stdout

亡梦爱人 提交于 2019-11-30 03:13:57
问题 I have a long running Torque/PBS job and I'd like to monitor output. But log file only gets copied after the job is finished. Is there a way to convince PBS to refresh it? 回答1: Unfortunately, AFAIK, that is not possible with PBS/Torque - the stdout/stderr streams are locally spooled on the execution host and then transferred to the submit host after the job has finished. You can redirect the standard output of the program to a file if you'd like to monitor it during the execution (it makes

How to create a batch file which work for both Program Files and Program Files(x86)?

你说的曾经没有我的故事 提交于 2019-11-30 01:29:38
问题 I have created a batch file which automatically copy a .sql file to the path of installed Jasper server(it could be any software installation directory). This is my batch script-- C:\PROGRA~2\JASPER~1.0\mysql\bin\mysql.exe -u root -proot < create_database.sql that is working when jasper is installed in Program Files(x86). How can i generalize it for both Program Files and Program Files(x86). 回答1: You want to use environment variables to look up things like this. On 32bit Windows,

dos command to sperate file name and extension into variables

拥有回忆 提交于 2019-11-30 00:49:27
I need to copy a file x.dtsx from location a to location b. If x.dtsx already exists in b then I need to rename x.dtsx to x_Standby.dtsx Then, after renaming copy x.dtsx to b My current code looks like this: if exists %1 rename %1 %(should be 1_standy.extension) xcopy %1 %2 If you use the Command Processor Extensions (which is default on Windows 2000 and later) then you can use the following optional syntax: %~1 - expands %1 removing any surrounding quotes (") %~f1 - expands %1 to a fully qualified path name %~d1 - expands %1 to a drive letter only %~p1 - expands %1 to a path only %~n1 -

Use slurm job id

僤鯓⒐⒋嵵緔 提交于 2019-11-30 00:18:42
When I launch a computation on the cluster, I usually have a separate program doing the post-processing at the end : sbatch simulation sbatch --dependency=afterok:JOBIDHERE postprocessing I want to avoid mistyping and automatically have the good job id inserted. Any idea? Thanks You can do something like this: RES=$(sbatch simulation) && sbatch --dependency=afterok:${RES##* } postprocessing The RES variable will hold the result of the sbatch command, something like Submitted batch job 102045 . The construct ${RES##* } isolates the last word (see more info here ), in the current case the job id

How do I get the error level of commands in a pipe in Windows batch programming?

社会主义新天地 提交于 2019-11-30 00:11:24
问题 Batch files return the error code of the last command by default. Is it somehow possible to return the error code of a former command. Most notably, is it possible to return the error code of a command in a pipe? For example, this one-line batch script foo.exe returns the error code of foo . But this one: foo.exe | tee output.txt always returns the exit code of tee , which is zero. 回答1: I had a similar problem and settled on the following solution as I did not need to detect the exact error

How to delete a line of a text file, given the line number using batch (.bat) script?

点点圈 提交于 2019-11-29 23:53:04
问题 I want to write a batch script where the user can enter the line number and the script will delete that line of a text file. Eg: tmp.txt 1. aaa 2. bbb 3. ccc 4. ddd I want when i execute my script and user inputs 3, the tmp.txt to be 1. aaa 2. bbb 4. ddd I am trying something like this: @ECHO OFF SET /P LINENUMBER=Enter the Line No: FOR /F "tokens=1* delims=[]" %%a IN ('FIND /n /v "" ^< tmp.txt') DO ( IF %%a equ %LINENUMBER% ( ???????????????????? ) ) 回答1: You cannot modify the file directly.

What's the equivalent of Python's Celery project for Java?

情到浓时终转凉″ 提交于 2019-11-29 20:48:26
I am trying to find an equivalent of Celery project for Java environment, I have looked at Spring Batch, but are there any better alternatives for distributed task queues. Thanks. Adam Gent What Celery is doing is very much akin to EIP , and SEDA with convenient task scheduling... (all you have left to do is add some DB, and async HTTP networking and you have got a complete enterprise quality stack). Basically in Java there is the Spring way, the Java EE way, and the Hadoop way: Spring: Spring Integration + Spring Batch + RabbitMQ Java EE: Mule + Quartz or EJB Scheduling + HornetMQ Hadoop:

Creating multiple videos with Avisynth

那年仲夏 提交于 2019-11-29 19:52:53
问题 I have a bunch of individual files that I want to each run through Avisynth. However, an AVS file can only create one video. As far as I know, there is no way to declare a variable's value from the command line. I know that you can probably create a script that generates a bunch of AVS files and then somehow convert each AVS file to a video. However, since Avisynth is a scripting system, this seems kind of complicated. There must be some way to run different videos through a script, right?

C# mongodb driver 2.0 - How to upsert in a bulk operation?

白昼怎懂夜的黑 提交于 2019-11-29 18:52:54
问题 I migrated from 1.9 to 2.2 and reading the documentation I was surprised to discover that is not possible to upsert during a bulk operation anymore, since operations don't allow options. bulkOps.Add(new UpdateOneModel<BsonDocument>(filter, update)); collection.BulkWrite(bulkOps); Should be options.isUpsert = true; bulkOps.Add(new UpdateOneModel<BsonDocument>(filter, update, options)); collection.BulkWrite(bulkOps); Is this work in progress, intended, or I'm missing something? Thank you. 回答1: