【发布时间】:2023-03-17 10:36:01
【问题描述】:
temp_file.txt
|112233456543214 |
|154233456873221|
|154233456868320|
当我使用下面的 nawk 命令时,如果你有空白空间,我看到数据正在跳过,所以我必须修剪空白。我必须在下面的命令中包含空白修剪(知道使用 nwak 命令单独)这是挑战。我的问题是如何在下面的命令中包含空白修剪
nawk -F '|' 'BEGIN{FS=OFS="|"}(length($2) >=13){
$2=substr($2,1,6)"xxxxxx"substr($2,length($2)-3)}1' temp_file.txt>tmp.txt && mv tmp.txt temp_file.txt
【问题讨论】: