0
我有一個字符串,它看起來像這樣:匹配文件和行號的sed
app/views/pages/_my_events_for_ba.html.erb:11: ba_mbn_programs = Program.ba_and_managed_bar.all(:conditions => "user_programs.user_id = #{current_user.id} and brand_id = #{brand.id}", :order => :name, :joins => [:user_programs], :select => "distinct programs.*")
我試圖孤立行號11
和文件名app/views/pages/_my_events_for_ba.html.erb
這樣我就可以通過這些參數打開VIM vim +11 app/views/pages/_my_events_for_ba.html.erb
。
但是我無法獲得sed的匹配,就像我想要的那樣工作。我試圖在作品Vim的正則表達式,但不與SED:
sed 's/\(.*\):\([0-9]\+\).*/\1 \2/p'
'-E'不一個'sed'選項 – hek2mgl
它適用於OSX,我相信這是與'-r' – Anthony
適合我的bsd。你有一個奇怪的版本'sed'? –