2014-04-04 58 views
0

我正在運行驗證軟件,我希望所有輸出都發送到文本文件,並將多個文件的結果放置/附加到同一文件。我以爲我的代碼正在工作,但我剛剛發現我只從1個文件輸出結果到文本文件。追加輸出結果

java -jar /Applications/epubcheck-3.0.1/epubcheck-3.0.1.jar ~/Desktop/Validator/*.epub 2>&1 | tee -a ~/Desktop/Validator/EPUBCHECK3_results.txt 

open ~/Desktop/Validator/EPUBCHECK3_results.txt 

編輯

當我使用的是Windows的命令行會處理一批文件,並適當appeand運行結果相同.jar文件。我只會這樣做,但這意味着必須切換工作站並傳輸文件來驗證它們。我想通過我的Mac系統上的Unix shell運行,這樣我就不必做不必要的工作。這是工作在下面的命令行:你所提供

FOR /f %%1 in ('dir /b "C:\Users\scrawfo\Desktop\epubcheck\drop epubs here\*.epub"') do (
echo %%1 >> epubcheck.txt 
java -jar "C:\Users\scrawfo\Desktop\epubcheck\epubcheck-3.0.jar" "C:\Users\scrawfo\Desktop\epubcheck\drop epubs here\%%1" 2>> epubcheck.txt 
echo. >> epubcheck.txt) 
notepad epubcheck.txt 
del epubcheck.txt 
+0

沒見過' open之前在shellcript中使用。你只是想打印文件的內容?如果是這樣,只需使用'貓'。 –

+0

我真的打電話打開文本文件後,它完成運行.jar驗證。 –

+1

你在做什麼應該工作。也許問題在別處。 –

回答

0

語法是正確的可能有一些問題與Java輸出什麼的請嘗試執行它不重定向

cat test 

輸出: -

This is Test File ...............

前執行命令的語法相同

ps l 2>&1 | tee -a test 

輸出: -

F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 4 0 3287 1 20 0 4060 572 n_tty_ Ss+ tty2
0:00 /sbin/mingetty /dev/tty2 4 0 3289 1 20 0 4060 572 n_tty_ Ss+ tty3 0:00 /sbin/mingetty /dev/tty3 4 0 3291
1 20 0 4060 576 n_tty_ Ss+ tty4 0:00 /sbin/mingetty /dev/tty4 4 0 3295 1 20 0 4060 576 n_tty_ Ss+ tty5
0:00 /sbin/mingetty /dev/tty5 4 0 3297 1 20 0 4060 572 n_tty_ Ss+ tty6 0:00 /sbin/mingetty /dev/tty6 4 0 19086
1 20 0 4060 572 n_tty_ Ss+ tty1 0:00 /sbin/mingetty /dev/tty1 4 0 20837 20833 20 0 108432 2148 wait Ss pts/0
0:00 -bash 4 0 21471 20837 20 0 108124 1036 - R+ pts/0 0:00 ps l 0 0 21472 20837 20 0 100908 664 pipe_w S+ pts/0
0:00 tee -a test

經過文件

cat test 

輸出:-(適當追加)

This is Test File ...............

F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 4 0 3287 1 20 0 4060 572 n_tty_ Ss+ tty2 0:00 /sbin/mingetty /dev/tty2 4 0 3289 1 20 0 4060 572 n_tty_ Ss+ tty3 0:00 /sbin/mingetty /dev/tty3 4 0 3291
1 20 0 4060 576 n_tty_ Ss+ tty4 0:00 /sbin/mingetty /dev/tty4 4 0 3295 1 20 0 4060 576 n_tty_ Ss+ tty5
0:00 /sbin/mingetty /dev/tty5 4 0 3297 1 20 0 4060 572 n_tty_ Ss+ tty6 0:00 /sbin/mingetty /dev/tty6 4 0 19086
1 20 0 4060 572 n_tty_ Ss+ tty1 0:00 /sbin/mingetty /dev/tty1 4 0 20837 20833 20 0 108432 2148 wait Ss pts/0
0:00 -bash 4 0 21471 20837 20 0 108124 1036 - R+ pts/0 0:00 ps l 0 0 21472 20837 20 0 100908 664 pipe_w S+ pts/0
0:00 tee -a test

+0

我運行該命令時沒有將輸出重定向到另一個文件,它仍然只對該目錄中的一個文件進行評估。我需要做的是評估目錄中的所有* .epub文件,併爲我提供所有這些文件的輸出 –

+0

您可以共享輸出 –

+0

Epubcheck版本3.0.1 驗證對EPUB版本2.0 錯誤:/ Users/scrawfo/Desktop/Validator/?????????????。epub/OEBPS/toc.ncx(21,45):斷言失敗:navPoint/navTarget/pageTarget的不同playOrder值指向相同的目標 錯誤:/Users/scrawfo/Desktop/Validator/?????????????.epub/OEBPS/toc.ncx(27,45):斷言失敗:不同的playOrder值爲navPoint/navTarget /涉及相同目標的pageTarget 檢查完成時顯示警告或錯誤 –