質問

Unixの「tail」コマンドに相当するものを探しています。これにより、書き込み中のログファイルの出力を監視できます。

役に立ちましたか?

解決

GNU Utilities for Win32 のようなものをインストールすることをお勧めします。尾を含むほとんどのお気に入りがあります。

他のヒント

PowerShellを使用している場合、これは機能します:

Get-Content filenamehere -Wait -Tail 30

ステファンのコメントを下から投稿して、人々が見逃さないようにします

PowerShell 3では、最後のx行のみを含める-Tailパラメーターが導入されています

Windowsのテーリングには、常に Baretail を使用しています。無料でとてもいい。

編集:Baretailの詳細については、 この質問

Cygwin の一部としてテールを取得できます。

バッチコマンドを使用した DOS CMDテールに興味がある人(下記参照)。

これは完全ではなく、行は時々繰り返されます。

使用法:tail.bat -d        tail.bat -f -f

@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
rem tail.bat -d <lines> <file>
rem tail.bat -f <file>

rem ****** MAIN ******
IF "%1"=="-d" GOTO displayfile
IF "%1"=="-f" GOTO followfile

GOTO end

rem ************
rem Show Last n lines of file
rem ************

:displayfile
SET skiplines=%2
SET sourcefile=%3

rem *** Get the current line count of file ***
FOR /F "usebackq tokens=3,3 delims= " %%l IN (`find /c /v "" %sourcefile%`) DO (call SET find_lc=%%l)

rem *** Calculate the lines to skip
SET /A skiplines=%find_lc%-!skiplines!

rem *** Display to screen line needed
more +%skiplines% %sourcefile%

GOTO end

rem ************
rem Show Last n lines of file & follow output
rem ************

:followfile
SET skiplines=0
SET findend_lc=0
SET sourcefile=%2

:followloop
rem *** Get the current line count of file ***
FOR /F "usebackq tokens=3,3 delims= " %%l IN (`find /c /v "" %sourcefile%`) DO (call SET find_lc=%%l)
FOR /F "usebackq tokens=3,3 delims= " %%l IN (`find /c /v "" %sourcefile%`) DO (call SET findend_lc=%%l)

rem *** Calculate the lines to skip
SET /A skiplines=%findend_lc%-%find_lc%
SET /A skiplines=%find_lc%-%skiplines%

rem *** Display to screen line when file updated
more +%skiplines% %sourcefile%

goto followloop

:end

非常に多くのオプションがありますが、それらにはすべて、より高度な機能を備えた欠陥があります。

Tail For Windows を使用しました。

tail
を使用するほどエレガントではありませんが、Windowsを使用しています。 ;)

回答のどこにもログエキスパートを見たことがありません。

カスタマイズ可能であり、ログファイルを移動するのに非常に適しています。これまでのところ、それは私にとって最高のWindowsグラフィカルログビューアです。

何もインストールしたくない場合は、「自分でビルドする」ことができます。標準のWindowsコマンドからジョブを実行するバッチファイル。方法については、次のポインターを参照してください。

1) find / c / v&quot;&quot;を使用しますyourinput.file 、入力ファイルの行数を取得します。出力は次のようになります。

---------- T.TXT: 15

2) for / f を使用して、この出力を解析して数値15を取得します。

3) set / a を使用して、スキップする必要があるヘッドラインの数を計算します

4) for / f&quot; skip = n&quot; を使用して、先頭行をスキップし、末尾行をエコー/処理します。

時間が見つかったら、そのようなバッチファイルを作成し、ここに投稿します。

Windows PowerShellでは、次を使用できます。

Get-Content <file> -Wait

最近 Mtail を使用しましたが、うまく機能しているようです。これは、前述のベアテールのようなGUIタイプです。 ここに画像の説明を入力してください

Windows Services for UNIX をお試しください。シェル、awk、sedなど、およびテールを提供します。

Windows Server 2003リソースキットツールの一部であるtailコマンドをダウンロードする= 17657 "rel =" nofollow noreferrer "> Microsoft 自体。

1つのウィンドウで複数のログファイルを同時に見ることができるため、TailMeの方が好きです。 http://www.dschensky.de/Software/Staff/tailme_en.htm

DOSにはテールコマンドがありません 。 GNU tailおよびその他のGNUツールのWindowsバイナリをこちらからダウンロードできます。

別のオプションは、 MSYS (Cygwinよりも軽量)をインストールすることです。

DOSの type は* nuxの cat のように機能しますが、 cat のようにファイル全体をダンプするため、実際には正しくありません tail ですが、真の tail 代替物をダウンロード/インストールすることなく、ピンチで利用できるようになります。

この小さなバッチスクリプトを作成しました。 Unixの「テール」ほど洗練されていませんが、出力をファイルの最後の10行に制限するなど、改善するために誰かが追加できることを願っています。このスクリプトを改善する場合は、送信してください〜[at]〜gmail.comでの強盗のことです。

@echo off

:: This is a batch script I wrote to mimic the 'tail' UNIX command.
:: It is far from perfect, but I am posting it in the hopes that it will
:: be improved by other people. This was designed to work on Windows 7.
:: I have not tested it on any other versions of Windows

if "%1" == "" goto noarg
if "%1" == "/?" goto help
if "%1" == "-?" goto help
if NOT EXIST %1 goto notfound
set taildelay=%2
if "%taildelay%"=="" set taildelay=1

:loop
cls
type %1

:: I use the CHOICE command to create a delay in batch.

CHOICE /C YN /D Y /N /T %taildelay%
goto loop

:: Error handlers

:noarg
echo No arguments given. Try /? for help.
goto die

:notfound
echo The file '%1' could not be found.
goto die

:: Help text

:help
echo TAIL filename [seconds]

:: I use the call more pipe as a way to insert blank lines since echo. doesnt
:: seem to work on Windows 7

call | more
echo Description:
echo     This is a Windows version of the UNIX 'tail' command.
echo     Written completely from scratch by Andrey G.
call | more
echo Parameters:
echo    filename             The name of the file to display
call | more
echo    [seconds]            The number of seconds to delay before reloading the
echo                         file and displaying it again. Default is set to 1
call | more
echo ú  /?                   Displays this help message
call | more
echo    NOTE:
echo    To exit while TAIL is running, press CTRL+C.
call | more
echo Example:
echo    TAIL foo 5
call | more
echo    Will display the contents of the file 'foo',
echo    refreshing every 5 seconds.
call | more

:: This is the end

:die

tail コマンドと他の多くのコマンドは Windowsリソースキットツールパッケージで入手できます。

Cygwinをインストールするのではなく、一部のUnixユーティリティのWin32ポートを使用する場合は、 Win32用のGNUユーティリティをお勧めします。

Cygwinより軽量でポータブル。

MKS Toolkit をインストール... WindowsですべてのUnixコマンドを実行できるようにします。

コマンドは次のとおりです。

tail -f <file-name>  

Far Manager で、 F3 を押して標準ビューアーに入り、次に End キーを押してファイルの終わりに移動します。

ファイルが更新されると、Far Managerは自動的にスクロールします。

私は Kiwi Log Viewer を使用しています。無料です。

グラフィカルログビューアは、ログファイルの表示には非常に適していますが、スクリプト(またはバッチファイル)に組み込むことができるコマンドラインユーティリティのニーズを満たしていません。多くの場合、このような単純で汎用的なコマンドは、特定の環境向けの特殊なソリューションの一部として使用できます。グラフィカルなメソッドは、そのような使用には向いていません。

バッチファイルでtail関数のニーズを満たすユーティリティを見つけたと思います。 「mtee」と呼ばれ、無料です。作業中のバッチファイルに組み込みましたが、非常にうまく機能します。実行可能ファイルをPATHステートメントのディレクトリに配置して、すぐに作業を終了してください。

リンクは次のとおりです。

mtee

WinTail も試すことができます。

&#1614;&#1614;

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top