Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在linux中如何将文件的单列改为大写?_Linux - Fatal编程技术网

在linux中如何将文件的单列改为大写?

在linux中如何将文件的单列改为大写?,linux,Linux,我有一个包含两个字段的文件。我需要将第一个字段的值从小写改为大写。谁能给我一个建议,我该怎么做 示例文件数据 e6|VerizonOctoberWB_PromoE7E6 e2|VerizonOctoberWB_UnlimwP_E1E2 e5|VerizonOctoberWB_PromoLI_E5 在上面的示例数据中,我需要更改第一个字段值(e6、e2、e5)因为您的示例很小且格式很差: cat up e6|VerizonOctoberWB_PromoE7E6 e2|VerizonOctobe

我有一个包含两个字段的文件。我需要将第一个字段的值从小写改为大写。谁能给我一个建议,我该怎么做

示例文件数据

e6|VerizonOctoberWB_PromoE7E6
e2|VerizonOctoberWB_UnlimwP_E1E2
e5|VerizonOctoberWB_PromoLI_E5

在上面的示例数据中,我需要更改第一个字段值(e6、e2、e5)

因为您的示例很小且格式很差:

cat up
e6|VerizonOctoberWB_PromoE7E6 
e2|VerizonOctoberWB_UnlimwP_E1E2 
e5|VerizonOctoberWB_PromoLI_E5


sed -r 's/^([^|]+)/\U\1\E/g' up
E6|VerizonOctoberWB_PromoE7E6 
E2|VerizonOctoberWB_UnlimwP_E1E2 
E5|VerizonOctoberWB_PromoLI_E5
编辑1:添加说明:
搜索并记住从队列开始到第一个分隔符的所有内容
|
,替换为
\U
(开始上套管),
\1
记住的字符串,
\E
停止上套管。

在询问之前您尝试过什么?嗨@Raswithapokala,欢迎来到StackOverflow,您可以查看以改进此问题和未来的问题。特别是你应该提供一些,以证明你已经试图解决自己的问题。你能解释一下这是什么意思吗?sed-r的/^([^ |]+)/\U\1\E/g'upI-can。完成。你知道多少正则表达式@Raswithapokala-这有帮助吗?解释有意义吗?