awk或sed单独提取每个列数

问题描述 投票:-2回答:1

您好我想通过命令将每个行计数提取到一个文件。

4495125 94307025    [email protected]   94307025.094307025  12443
stazla  [email protected]  1992/.:\1
1447585 [email protected] h1st@1
saknit  [email protected]   1233    1990
_______________________________________________________
5column.txt
4495125 94307025    [email protected]   94307025.094307025  12443
_______________________________________________________
4column.txt 
saknit  [email protected]   1233    1990
_______________________________________________________
3column.txt 
stazla  [email protected]  1992/.:\1
1447585 [email protected] h1st@1

我需要代码才能完成这项工作!

bash awk sed
1个回答
0
投票

以下awk可以帮助你。

awk '{print > NF"column.txt"}'  Input_file

输出它将创建3个名为5column.txt4column.txt3column.txt的文件。

© www.soinside.com 2019 - 2024. All rights reserved.