用Sed获取第N个角色

Ale*_*ura 5 string sed

我正处于玩最终幻想7的中间,我正处于你在Shinra HQ图书馆的那一部分,你必须写下N字母 - 减去空格,其中Nth是数字书的标题前面 - 对于每本似乎不属于当前房间的书,其中有4本.

我需要一个sed脚本或其他命令行来打印书的标题并Nth在其名称中输入字母.

jay*_*ngh 6

你不需要那样做sed.您可以使用bash字符串替换:

$ book="The Ancients in History"
$ book="${book// /}"   # Do global substition to remove spaces
$ echo "${book:13:1}"  # Start at position 13 indexed at 0 and print 1 character
H
Run Code Online (Sandbox Code Playgroud)