下面是“file1.txt”的统计结果
`File: 'file1.txt'
Size: 477 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 55599980 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ marc) Gid: ( 1000/
marc)
Access: 2018-04-19 19:19:01.708143285 +0200
Modify: 2018-04-19 19:18:58.216117199 +0200
Change: 2018-04-19 19:18:58.216117199 +0200
Birth: -`
我想用grep获取“修改”行:
`stat file1.txt | grep Modify
Modify: 2018-04-19 19:18:58.216117199 +0200`
我现在想在file1的第一行之前插入这一行。txt。
我会使用如下命令:
`stat file1.txt | grep Modify | sed -i '1 i\"result_of_grep"' file1.txt`,
但不知道如何告诉shell使用前面grep dommand的结果(我称之为“result\u of\u grep”)。
提前感谢。。。