使用sed
如何替换以星号开头的行并将其替换为从 1 开始的数字?
例如,我需要使用 sed 用数字替换列表中的 (*) >
这个文件包含一个列表
*linux
*computers
*labs
*questions
Run Code Online (Sandbox Code Playgroud)
到 >>>>
这个文件包含一个列表
1 linux
2 computers
3 labs
4 questions
Run Code Online (Sandbox Code Playgroud)
我尝试使用
sed -e 's/*//' file.in > file.out | sed -i = file.out
Run Code Online (Sandbox Code Playgroud)