在插入语句的选择中引用多个单词
Quote multiple words in a selection for insert statement
我正在寻找一种在选择中引用单词的快速方法,就像我要从由制表符或 space 字符分隔的文本块构建许多插入语句一样。
假设我有
STUFF OPEN F 0 0 00:00:00-23:59:59
STUFF OPEN M 0 0 00:00:00-23:59:58
STUFF OPEN R 0 0 00:00:00-23:59:59
STUFF OPEN S 0 0 00:00:00-23:59:59
STUFF OPEN T 0 0 00:00:00-23:59:59
STUFF OPEN U 0 0 00:00:00-23:59:59
STUFF OPEN W 0 0 00:00:00-23:59:59
我想得到
"STUFF" "OPEN" "F" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "M" "0" "0" "00:00:00-23:59:58"
"STUFF" "OPEN" "R" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "S" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "T" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "U" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "W" "0" "0" "00:00:00-23:59:59"
一次点击或更少。在 np++ 中,我不得不查找替换 3 次,只是想知道我是否可以用更少的体力劳动快速完成这项工作? (喜欢选择、点击、完成。)
我有 vim、notepad++、Eclipse、VS 2013
没有 emacs,但如果我能在 cygwin 中运行它并更快地完成这种事情,我愿意试一试
在记事本++中
确保光标位于文件的开头,按 ctrl+h 和 select 正则表达式。将表达式 (\S+)
与 ""
结合使用
如果您不得不多次执行此操作,您可以进入 Macro
> Start Recording
并执行替换 Stop Recording
。之后你可以保存它并给它一个快捷方式(或按ctrl+shift+p播放当前宏)。
在 Vim 中,您可以使用此替换:
:%s/\S\+/"&"/g
读作 "on every line in the buffer (:%
), substitute every (s/search/replace/g
) one or more (\+
) non-whitespace character (\S
) with a double quote ("
), followed by the matched string (&
), followed by a second double quote ("
)"。
我正在寻找一种在选择中引用单词的快速方法,就像我要从由制表符或 space 字符分隔的文本块构建许多插入语句一样。
假设我有
STUFF OPEN F 0 0 00:00:00-23:59:59
STUFF OPEN M 0 0 00:00:00-23:59:58
STUFF OPEN R 0 0 00:00:00-23:59:59
STUFF OPEN S 0 0 00:00:00-23:59:59
STUFF OPEN T 0 0 00:00:00-23:59:59
STUFF OPEN U 0 0 00:00:00-23:59:59
STUFF OPEN W 0 0 00:00:00-23:59:59
我想得到
"STUFF" "OPEN" "F" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "M" "0" "0" "00:00:00-23:59:58"
"STUFF" "OPEN" "R" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "S" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "T" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "U" "0" "0" "00:00:00-23:59:59"
"STUFF" "OPEN" "W" "0" "0" "00:00:00-23:59:59"
一次点击或更少。在 np++ 中,我不得不查找替换 3 次,只是想知道我是否可以用更少的体力劳动快速完成这项工作? (喜欢选择、点击、完成。)
我有 vim、notepad++、Eclipse、VS 2013
没有 emacs,但如果我能在 cygwin 中运行它并更快地完成这种事情,我愿意试一试
在记事本++中
确保光标位于文件的开头,按 ctrl+h 和 select 正则表达式。将表达式 (\S+)
与 ""
如果您不得不多次执行此操作,您可以进入 Macro
> Start Recording
并执行替换 Stop Recording
。之后你可以保存它并给它一个快捷方式(或按ctrl+shift+p播放当前宏)。
在 Vim 中,您可以使用此替换:
:%s/\S\+/"&"/g
读作 "on every line in the buffer (:%
), substitute every (s/search/replace/g
) one or more (\+
) non-whitespace character (\S
) with a double quote ("
), followed by the matched string (&
), followed by a second double quote ("
)"。