Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文件,其中包含这样的行:
004662484 4 0 0 0 0
第二列是数字 4,我想用这个数字将这一行提取为 4 行,如下所示:
004662484 0 0 0 0 0 004662484 1 0 0 0 0 004662484 2 0 0 0 0 004662484 3 0 0 0 0
如何使用其中一个或两个来做到这awk一点sed?谢谢!
awk
sed
{ reps = $2; for (i = 0; i < reps; i++) { $2 = i; print $0; } }