grep을 사용할 때 콘솔에 출력 표시

grep을 사용할 때 콘솔에 출력 표시

vim에서는 다음 명령을 사용하여 tex 파일을 컴파일합니다.

pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ grep\ \-P\ ':\\d{1,5}:\ '

이렇게 하면 오류가 빠른 수정 창에 표시됩니다(vim을 사용하지 않는 경우 이 문장을 무시하세요).유일한 문제는 문서가 컴파일되는 동안 라텍스 출력이 화면에 나타나는지 보고 싶다는 것입니다.(이제 grep은 모든 출력을 먹습니다).

이를 달성하려면 무엇을 변경해야 합니까? 나는 그것을 모두 파이핑하려고 시도했지만 tail소용이 없었습니다.

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) (format=preamble 2011.10.2)  3 OCT 2011 23:16
entering extended mode
 \write18 enabled.
 file:line:error style messages enabled.
 %&-line parsing enabled.
**main.tex
(./main.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
 icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
 lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
PRECOMILED PREAMBLE LOADED

LaTeX Warning: Overwriting file `./main.bib'.

\openout15 = `main.bib'.


\openout4 = `main.auxlock'.

Package biblatex Info: Trying to load language 'english'...
Package biblatex Info: ... file 'english.lbx' found.
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/lbx/english.lbx
File: english.lbx 2011/07/29 v1.6 biblatex localization
)

Package biblatex Warning: 'babel' detected but 'csquotes' missing.
(biblatex)                Loading 'csquotes' recommended.

\@quotelevel=\count451
\@quotereset=\count452
(./main.aux)
\openout1 = `main.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for PD1/pdf/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 42.
LaTeX Font Info:    Try loading font information for TS1+cmr on input line 42.
 (/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info:    ... okay on input line 42.
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: subfig package 1.2 or 1.3 is loaded.
Package caption Info: float package is loaded.
Package caption Info: hyperref package is loaded.
Package caption Info: wrapfig package is loaded.
Package caption Info: End \AtBeginDocument code.

(/usr/local/texlive/2011/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count453
\scratchdimen=\dimen319
\scratchbox=\box86
\nofMPsegments=\count454
\nofMParguments=\count455
\everyMPshowfont=\toks48
\MPscratchCnt=\count456
\MPscratchDim=\dimen320
\MPnumerator=\count457
\makeMPintoPDFobject=\count458
\everyMPtoPDFconversion=\toks49
) (/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf

(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2010/08/19 v1.1 Managing graphics extensions (HO)
)
Package grfext Info: Graphics extension search list:
(grfext)             [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext)             \AppendGraphicsExtensions on input line 452.

(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
Package biblatex Info: No input encoding detected.
(biblatex)             Assuming 'ascii'.
Package biblatex Info: Automatic encoding selection.
(biblatex)             Assuming data encoding 'ascii'.
\openout3 = `preamble-blx.bib'.

Package biblatex Info: Trying to load bibliographic data...
Package biblatex Info: ... file 'main.bbl' not found.

No file main.bbl.
Package biblatex Info: Reference section=0 on input line 42.
Package biblatex Info: Reference segment=0 on input line 42.
ABD: EveryShipout initializing macros
\AtBeginShipoutBox=\box87
Package hyperref Info: Link coloring ON on input line 42.

(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/nameref.sty
Package: nameref 2010/04/30 v2.40 Cross-referencing by name of section

(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/gettitlestring.sty
Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO)
)
\c@section@level=\count459
)
LaTeX Info: Redefining \ref on input line 42.
LaTeX Info: Redefining \pageref on input line 42.
LaTeX Info: Redefining \nameref on input line 42.

(./main.out) (./main.out)
\@outlinefile=\write8
\openout8 = `main.out'.


(/usr/local/texlive/2011/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-basic-dictionary/translator-basic-dictionary-English.dict
Dictionary: translator-basic-dictionary, Language: English 
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviati
ons.cfg
File: siunitx-abbreviations.cfg 2011/09/13 v2.3f siunitx: Abbreviated units
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
File: siunitx-binary.cfg 2011/09/13 v2.3f siunitx: Binary units
)
LaTeX Info: Redefining \microtypecontext on input line 42.
Package microtype Info: Generating PDF output.
Package microtype Info: Character protrusion enabled (level 2).
Package microtype Info: Using default protrusion set `alltext'.
Package microtype Info: Automatic font expansion enabled (level 2),
(microtype)             stretch: 20, shrink: 20, step: 1, non-selected.
Package microtype Info: Using default expansion set `basictext'.
Package microtype Info: No tracking.
Package microtype Info: No adjustment of interword spacing.
Package microtype Info: No adjustment of character kerning.
Package microtype Info: Redefining babel's language switching commands.
 (/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-cmr.cfg
File: mt-cmr.cfg 2009/11/09 v2.0 microtype config. file: Computer Modern Roman 
(RS)
)
\c_siunitx_mathsf_int=\count460
LaTeX Font Info:    Try loading font information for U+msa on input line 42.

(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2009/06/22 v3.00 AMS symbols A
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-msa.cfg
File: mt-msa.cfg 2006/02/04 v1.1 microtype config. file: AMS symbols (a) (RS)
)
LaTeX Font Info:    Try loading font information for U+msb on input line 42.

(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2009/06/22 v3.00 AMS symbols B
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-msb.cfg
File: mt-msb.cfg 2005/06/01 v1.0 microtype config. file: AMS symbols (b) (RS)
)
LaTeX Font Info:    Try loading font information for U+esint on input line 42.

(/usr/local/texlive/2011/texmf-dist/tex/latex/esint/uesint.fd
File: uesint.fd 
)
LaTeX Font Info:    Try loading font information for U+rsfs on input line 42.

(/usr/local/texlive/2011/texmf-dist/tex/latex/jknapltx/ursfs.fd
File: ursfs.fd 1998/03/24 rsfs font definition file (jk)
)
\c_siunitx_mathtt_int=\count461

./main.tex:47: Undefined control sequence.
l.47 \akaka

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Package atveryend Info: Empty hook `BeforeClearDocument' on input line 51.
[1{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Package atveryend Info: Empty hook `AfterLastShipout' on input line 51.

(./main.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 51.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 51.
Package rerunfilecheck Info: File `main.out' has not changed.
(rerunfilecheck)             Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
Package logreq Info: Writing requests to 'main.run.xml'.
\openout1 = `main.run.xml'.

 ) 
Here is how much of TeX's memory you used:
 2167 strings out of 455899
 40306 string characters out of 2353312
 1131909 words of memory out of 3000000
 42382 multiletter control sequences out of 15000+200000
 26633 words of font info for 111 fonts, out of 3000000 for 9000
 831 hyphenation exceptions out of 8191
 36i,6n,45p,773b,1377s stack positions out of 5000i,500n,10000p,200000b,50000s
{/usr/local/texlive/2011/texmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc}
</usr/local/texlive/2011/texmf-dist/fonts/type1/public/cm-super/sfrm1000.pfb></
usr/local/texlive/2011/texmf-dist/fonts/type1/public/cm-super/sfrm1200.pfb></us
r/local/texlive/2011/texmf-dist/fonts/type1/public/cm-super/sfrm1728.pfb>
Output written on main.pdf (1 page, 19387 bytes).
PDF statistics:
 29 PDF objects out of 1000 (max. 8388607)
 22 compressed objects within 1 object stream
 2 named destinations out of 1000 (max. 500000)
 23053 words of extra memory for PDF output out of 24883 (max. 10000000)

Vim은 다음만 표시해야 합니다:

main.tex l.47 undefined control sequence

그러나 나는 어떤 페이지가 컴파일되고 있는지 등에 대한 피드백을 얻을 수 있도록 출력을 보고 싶습니다.

답변1

errorformat출력 대신 grep을 사용해 보셨습니까 ? CFhttp://vim.wikia.com/wiki/Errorformats. 명령을 설정하면 make(http://vim.wikia.com/wiki/Make_make_more_helpful).

업데이트된 출력에 감사드립니다, romovs. 비슷한 것을 갖고 싶은 것 같습니다.

set errorformat=%E%f:%l:\ %m%C1.%l\ %Z

이것을 테스트할 수는 없지만 출력 결과에 따르면 원하는 대로 된 것 같습니다.

답변2

너 진짜 꼭 확인해 봐야 해지우개(많은 배포판에 패키지되어 있음):

Rubber는 LaTeX 문서 편집과 관련된 모든 작업을 처리하는 것이 목적인 프로그램입니다. 물론 여기에는 문서 자체를 컴파일하고 모든 참조를 정의하는 데 충분한 시간을 허용하며 BibTeX를 실행하여 참고문헌을 관리하는 것이 포함됩니다. 또한 PostScript 문서를 생성하기 위한 dvips의 자동 실행과 PDF 문서를 생성하기 위한 pdfLaTeX 사용도 포함됩니다.

고무협회숨다모든 출력(.log 파일로 리디렉션됨) 및관련 오류 메시지만 표시전화했을 때.

답변3

출력 버퍼링에 관한 것입니다.

당신이 직면한 문제는 작동 방법이 아닙니다 grep.관로하다. 혹은 좀 더 정확하게는 어떻게pdflatex 허용하다배관 작업. 표준 방식으로 파이프를 사용합니다. 즉, 파이프를 통한 출력은 다음과 같습니다.버퍼링됨. 프로그램은 pdflatex자체 출력을 버퍼링할 수 있는지 여부를 결정합니다. 확실하지는 않지만 이 프로그램 부분에서 리디렉션된 출력을 버퍼링하지 않도록 지시하는 표준 옵션이 없다고 생각합니다.

stdbuf그러나 이 프로그램을 command() 주위의 일종의 래퍼로 사용 pdflatex하고 출력 스트림의 문자를 필요에 맞게 조정할 수 있습니다.

stdbuf -oL pdflatex -file-line-error ... | grep ...

또는

stdbuf -o0 pdflatex -file-line-error ... | grep ...

(가독성을 위해 이스케이프가 제거되고 명령이 잘렸습니다.) man stdbuf자세한 내용은 참고자료를 참조하세요.

또는 다음을 수행할 수 있습니다.장난 pdflatex(상당히 무해함) 출력이 리디렉션되지 않는다고 "생각"하여 출력을 버퍼링하지 않습니다. 이 script프로그램은 다음 용도로 사용할 수 있습니다.

script -c 'pdflatex -file-line-error ... ' | grep ...

전체 pdflatex ...명령은 따옴표로 묶어야 합니다.

답변4

최종 명령을 실행하기 전에 제어 터미널에 tee액세스 해 볼까요 stdout?/dev/ttystdoutgrep

# example using ls instead of pdflatex in Bash

# all of stdout goes to the controlling terminal before grep
ls -ld / errorfile 2>&1 | tee /dev/tty | grep error

# only grep-filterd stdout goes to the controlling terminal before the final grep
ls -ld / errorfile 2>&1 | tee >(grep --line-buffered error > /dev/tty) | 
    grep error

관련 정보