精華區beta RegExp 關於我們 聯絡資訊
我想用 grep 在 vim 內抓出論文的大綱。 :vimgrep /section{\|epsfig/ 結果如下 \section{Introduction} \section{Background and Problem Formulation} \centering\epsfig{file=figs/fig1-1.eps,angle=0,width=3.2in} \section{Proposed Technique:\\ Phase Partition Method} \subsection{A Suboptimal Subset of Nodes} %%%\subsection{Dividing the Available Sensor Nodes in Suboptimal \section{Simulation Results} \subsection{Proof of concept} \epsfig{file=figs/fig11.eps,width=3.3in}\\ % \epsfig{file=figs/fig25.eps,width=3.3in}\\ %\subsection{Effect of number of sensors} %\epsfig{file=figs/fig68.eps,width=2.30in}\\ \epsfig{file=figs/fig68.eps,width=2.30in}\\ \section{Discussion and Future Work} % \section{Discussion} \section{Conclusion} 請問要如何改才能避掉開頭有 % 註解的那幾行? 因為註解的格式沒有用的很整齊,變得有點複雜。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 128.211.253.111 ※ 編輯: oversky0 來自: 128.211.253.111 (10/25 22:52)
COLDTURNIP:vim 內部搜尋:/^[^%]*\(section{\|epsfig\) 10/26 06:14
謝謝,後來發現抓圖的 caption 比較好,再修改一下你的方案成 /^[\s]*\\\(sub\)*section{\\|^[\s]*\\caption{/ % 這樣連 subsection, subsubsection 都能抓到,結果如下: \section{Introduction} \section{Background and Problem Formulation} \caption{Concept of distributed beamforming. The chosen nodes form a \section{Proposed Technique:\\ Phase Partition Method} \subsection{A Suboptimal Subset of Nodes} \caption{Normalized power as function of relative phase difference \subsection{Dividing the Available Sensor Nodes in Suboptimal \subsubsection{Test1} \subsubsection{Test2} \caption{Sensor distribution as a function of phase. The Phase \section{Simulation Results} \subsection{Proof of concept} \caption{Proof of concept. $M=100, \rho=1 \lambda.\ \overline D_{max} = \subsection{Effect of Distribution Radius} \caption{Effect of distribution radius.} \subsection{Effect of number of sensors} \caption{Effect of number of sensors.} \subsection{Effect of phase uncertainty} \caption{Effect of phase uncertainty. $M=1000$, $\rho=100 \lambda$. All \section{Discussion and Future Work} \section{Conclusion} 有辦法再進化成下面那樣樹狀結構嗎? Introduction Background and Problem Formulation Fig: Concept of distributed beamforming. The chosen nodes form a Proposed Technique:\\ Phase Partition Method A Suboptimal Subset of Nodes Fig: Normalized power as function of relative phase difference Dividing the Available Sensor Nodes in Suboptimal Test1 Test2 大概還要加上 1. 取 { } 中的字,不過有的 } 被折到下一行了 2. 在 subsection 前加一個 TAB 3. 在 subsubsection 前加兩個 TAB 4. 在 caption 前加 一個 TAB 及 fig: 不過要判斷 caption 是在那一層可能還要加上上下文分析才行。 ※ 編輯: oversky0 來自: 128.211.253.111 (10/26 08:35) ※ 編輯: oversky0 來自: 128.211.253.111 (10/26 08:38) > -------------------------------------------------------------------------- < 作者: COLDTURNIP (COLDTURNIP) 看板: RegExp 標題: Re: [問題] 如何刪除開頭有註解的 時間: Mon Oct 26 12:41:35 2009 ※ 引述《oversky0 (oversky0)》之銘言: : 謝謝,後來發現抓圖的 caption 比較好,再修改一下你的方案成 : /^[\s]*\\\(sub\)*section{\\|^[\s]*\\caption{/ % : 這樣連 subsection, subsubsection 都能抓到,結果如下: : : \section{Introduction} : \caption{Concept of distributed beamforming. The chosen nodes form a : \subsection{A Suboptimal Subset of Nodes} : : 有辦法再進化成下面那樣樹狀結構嗎? : Introduction : Background and Problem Formulation : Fig: Concept of distributed beamforming. The chosen nodes form a : Proposed Technique:\\ Phase Partition Method : A Suboptimal Subset of Nodes : Fig: Normalized power as function of relative phase difference : Dividing the Available Sensor Nodes in Suboptimal : Test1 : Test2 : 大概還要加上 : 1. 取 { } 中的字,不過有的 } 被折到下一行了 : 2. 在 subsection 前加一個 TAB : 3. 在 subsubsection 前加兩個 TAB : 4. 在 caption 前加 一個 TAB 及 fig: : : 不過要判斷 caption 是在那一層可能還要加上上下文分析才行。 以下全部使用 vim 的一般模式處理。 我是假設每行都已經處理成 blahblah{blah blah blah...(非巢狀結構)...} 的形式,所以如果不是這樣的話再微調一下。 Step 1. 先把 { } 都接成一行 :g/^[^}]\+$/;/^[^{]*}$/j Step 2. 處理 subsection :%s/subsection{\(.*\)}/\t\1/ Step 3. 處理 subsubsection :%s/subsubsection{\(.*\)}/\t\t\1/ Step 4. 處理 caption :%s/caption{\(.*\)}/\tfig: \1/ 收工 :) -- 尚 我 我 有 尚 我 我 有 尚 我 我 有 寐 逢 生 尚 生 雉 兔 寐 逢 生 尚 生 雉 兔 寐 逢 生 尚 生 雉 兔 無 此 之 無 之 離 爰 無 此 之 無 之 離 爰 無 此 之 無 之 離 爰 聰 百 後 庸 初 于 爰 覺 百 後 造 初 于 爰 叱 百 後 為 初 于 爰 ! 凶 , ; , 罿 , ! 憂 , ; , 罦 , ! 罹 , ; , 羅 , 。 。 。 。 。 。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.166.66.253
oversky0:謝謝。Vim 的 quickfix 好像不能 modify ,我要再想想要 10/27 11:35
oversky0:怎麼用。我可以把 code 提交給 ctags 的開發人員參考嗎? 10/27 11:37
COLDTURNIP:請 w 10/27 22:14