📄 filefilter.hlp
字号:
{smcl}
{* 20jan2005}{...}
{cmd:help filefilter}
{hline}
{title:Title}
{p2colset 5 23 25 2}{...}
{p2col :{hi:[D] filefilter} {hline 2}}Convert ASCII text or binary patterns in
a file{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 19 2}
{opt filef:ilter}
{it:oldfile}
{it:newfile}
{cmd:,}
{opt f:rom(oldpattern)}
{opt t:o(newpattern)}{break}
[{it:{help filefilter##options:options}}]
{p 4 4 2}
where {it:oldpattern} and {it:newpattern} for ASCII characters are
{p 13 42 2}{cmd:"}{it:string}{cmd:"} or {cmd:}{it:string}{cmd:}
{p2colset 25 40 42 2}{...}
{p2col 14 40 42 2 :{it:string}{space 2}{cmd::=} {cmd:[}{it:char}{cmd:[}{it:char}{cmd:[}{it:char}{cmd:[}{it:...}{cmd:]]]]}}{p_end}
{p2col 14 40 42 2 :{it:char}{space 4}{cmd::=} {it:regchar}{cmd: | }{it:code}}{p_end}
{p2col 14 40 42 2 :{it:regchar} {cmd::=} ASCII 32-91, 93-128, 161-255; excludes '\'}{p_end}
{p2col 14 40 42 2 :{it:code}{space 4}{cmd::=} {cmd:\BS}}backslash{p_end}
{p2col :{cmd:\r}}carriage return{p_end}
{p2col :{cmd:\n}}newline{p_end}
{p2col :{cmd:\t}}tab{p_end}
{p2col :{cmd:\M}}Macintosh EOL, or \r{p_end}
{p2col :{cmd:\W}}Windows EOL, or \r\n{p_end}
{p2col :{cmd:\U}}Unix EOL, or \n{p_end}
{p2col :{cmd:\LQ}}left single quote `{p_end}
{p2col :{cmd:\RQ}}right single quote '{p_end}
{p2col :{cmd:\Q}}double quote "{p_end}
{p2col :{cmd:\$}}dollar ${p_end}
{p2col :{cmd:\}{it:###}{cmd:d}}3-digit [0-9] decimal ASCII{p_end}
{p2col :{cmd:\}{it:##}{cmd:h}}2-digit [0-9,A-F] hexadecimal ASCII{p_end}
{p2colreset}{...}
{synoptset 20 tabbed}{...}
{marker options}{...}
{synopthdr}
{synoptline}
{p2coldent :* {opt f:rom(oldpattern)}}find {it:oldpattern} to be
replaced{p_end}
{p2coldent :* {opt t:o(newpattern)}}use {it:newpattern} to replace
occurrences of {opt from()}{p_end}
{synopt :{opt r:eplace}}replace {it:newfile} if it already exists{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}* {opt from(oldpattern)} and {opt to(newpattern)} are required.{p_end}
{title:Description}
{pstd}
{opt filefilter} reads an ASCII input file, searching for {it:oldpattern}.
Whenever a matching pattern is found, it is replaced with {it:newpattern}.
All resulting data, whether matching or nonmatching, is then written to the
new ASCII file.
{pstd}
Because of the buffering design of {opt filefilter}, arbitrarily large files
can be converted very quickly. {opt filefilter} is also useful when traditional
editors cannot edit a file, such as when unprintable ASCII characters
are involved. In fact, converting end-of-line characters between Macintosh,
Windows, and Unix is very convenient with the EOL codes.
{pstd}
Unicode is not directly supported at this time, but you can attempt to
operate on a Unicode system by breaking a 2-byte character into the
corresponding 2-char ASCII
representation. However, this goes beyond the original
design of the command and is technically unsupported.
If you attempt to use {opt filefilter} in this manner, you might encounter
problems with variable-length encoded Unicode.
{pstd}
Although it is not mandatory, you may want to use quotes to delimit a pattern,
protecting the pattern from Stata's parsing routines.
A pattern that contains blanks must be quoted.
{title:Options}
{phang}{opt from(oldpattern)} is required and specifies the
pattern to be found and replaced.
{phang}{opt to(newpattern)} is required and specifies the pattern
used to replace occurrences of {opt from()}.
{phang}{opt replace} specifies that {it:newfile} be replaced if it
already exists.
{title:Examples}
{phang}{cmd:. filefilter macfile.txt winfile.txt, from(\M) to(\W) replace}
{phang}{cmd:. filefilter auto1.csv auto2.csv, from(\LQ) to("left quote")}
{phang}{cmd:. filefilter auto1.csv auto2.csv, from(\60h) to("left quote")}
{phang}{cmd:. filefilter auto1.csv auto2.csv, from(\096d) to("left quote")}
{phang}{cmd:. filefilter file1.txt file2.txt, from("\6BhText\100dText") to("")}
{title:Also see}
{psee}
Manual: {bf:[D] filefilter}
{psee}
Online: {helpb file}, {helpb hexdump}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -