linux一行为啥显示成多行,linux 用awk gsub将一行变成多行

原数据

103153926#1180545867#1337681140#1358188028#1445076068#1527059220#1625614569#1890561581#19584762#2214121812#2342720441#2500121842#25326345#2640225664#409811166#461094177#596719064#611522202#741345319#759125996#98001626#997750230

1420151716#184147046#2785699737#344498087

目标结果

103153926 1

1180545867 1

1337681140 1

1358188028 1

1445076068 1

1527059220 1

1625614569 1

1890561581 1

19584762 1

2214121812 1

2342720441 1

2500121842 1

25326345 1

2640225664 1

409811166 1

461094177 1

596719064 1

611522202 1

741345319 1

759125996 1

98001626 1

997750230 1

1420151716 2

184147046 2

2785699737 2

344498087 2

对数据进行修改,在最后加一个#

103153926#1180545867#1337681140#1358188028#1445076068#1527059220#1625614569#1890561581#19584762#2214121812#2342720441#2500121842#25326345#2640225664#409811166#461094177#596719064#611522202#741345319#759125996#98001626#997750230#

1420151716#184147046#2785699737#344498087#

awk 'BEGIN{i=1}{gsub(/#/,"\t"i"\n");i++;print}' uids|sed '/^$/d' > uids_seg

原创文章,作者:kinpo, k,如若转载,请注明出处:https://www.yidc.net/archives/4483

你可能感兴趣的:(linux一行为啥显示成多行)