【问题标题】:Concat multiple columns in notepadd++在记事本++中连接多列
【发布时间】:2021-12-29 14:36:41
【问题描述】:

我有以下 2 列数据,我想在 notepadd++ 中将它们并排连接在一起。有人可以帮助如何做到这一点。

第 1 列

cluster_identifier
cluster_parameter_group
db_parameter_group
instance_class
cluster_instance_count
engine

column2

= "{{ sdf.cluster_identifier }}"
= "{{ sdf.cluster_parameter_group }}"
= "{{ sdf.db_parameter_group }}"
= "{{ sdf.instance_class }}"
= "{{ sdf.cluster_instance_count }}"
= "{{ sdf.engine }}"
= "{{ sdf.engine_version }}"

notepad++ 中的最终版本

cluster_identifier      = "{{ sdf.cluster_identifier }}"
cluster_parameter_group = "{{ sdf.cluster_parameter_group }}"
db_parameter_group      = "{{ sdf.db_parameter_group }}"
instance_class          = "{{ sdf.instance_class }}"
cluster_instance_count  = "{{ sdf.cluster_instance_count }}"
engine                  = "{{ sdf.engine }}"
engine_version          = "{{ sdf.engine_version }}"

【问题讨论】:

    标签: notepad++


    【解决方案1】:

    似乎第二列是从第一列构建的。然后我会做这样的事情:

    • Ctrl+H
    • 查找内容:^.+$
    • 替换为:$0\t= "{{ sdf.$0 }}"
    • 检查 环绕
    • CHECK 正则表达式
    • 取消选中 . matches newline
    • 全部替换

    说明:

    ^           # beginning of line
    .+          # 1 or more any character but newline
    $           # end of line
    

    替换:

    $0              # the whole match
    \t              # a tabulation
    = "{{ sdf.      # literally
    $0              # the whole match
     }}"            # literally
    

    屏幕截图(之前):

    截图(之后):

    【讨论】:

    • 有什么办法我也可以处理 =.* 的缩进,用于其他所有行的缩进
    • @AbhishekSolanki:恐怕你不能。尝试使用多个 \t 而不是 1。
    【解决方案2】:

    您可以使用柱状剪切和粘贴:

    在 column2 行上使用 ^C 时按住 Alt 键,然后将它们粘贴到 column1 的第 1 行的末尾。

    Example

    R

    【讨论】:

    • 这也有效,谢谢 :) 有什么方法我也可以处理 =.* 的缩进,用于其他所有行的缩进
    • 使用我的解决方案,如果您在第一行添加多个空格,在粘贴 column2 之前,它们将对齐到相同的缩进。
    • 如果我在 column2 中添加空格,缩进会变得不相等。我没有正确给出正确的所有“=”符号。
    • 我没有告诉你将空格添加到column2,只将空格添加到column1的第一行,然后将你复制的列粘贴到columnly,我刚刚做到了,它作品。如果我不够清楚,请看superuser.com/questions/1110754/…
    猜你喜欢
    • 2012-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多