好吧,所以我知道使用$打印一行的特定参数非常简单:
$ cat file
hello world
$ awk '{print $1}' file
hello
Run Code Online (Sandbox Code Playgroud)
但是如果我想打印2到8的字符怎么办?还是3到7?用awk可以吗?
nim*_*ims 58
awk '{print substr($0,2,6)}' file
Run Code Online (Sandbox Code Playgroud)
substr()的语法是
substr(string,start index,length)
| 归档时间: |
|
| 查看次数: |
68288 次 |
| 最近记录: |