如何在Linux Bash Shell命令行右侧删除整个单词
如:
CTRL U = Delete left of the cursor
CTRL K = Delete right of the cursor
CTRL W = Delete word on the left
Run Code Online (Sandbox Code Playgroud)
我想知道一种删除右侧整个单词的快捷方式,无论单词中的光标在哪里,就像在vim opt中一样:
daw
Run Code Online (Sandbox Code Playgroud)
我想在bash命令行中得到相同的结果。
# cat a.file
123123abc file2
274efcc4d8a0e8f61397be46bd4bfa37 file1
321 file1
# file="file1"
# grep -m 1 -oP "\K([\w]+) +$file" a.file
274efcc4d8a0e8f61397be46bd4bfa37 file1
Run Code Online (Sandbox Code Playgroud)
如何274efcc4d8a0e8f61397be46bd4bfa37使用参数file1行获取输出,并且只使用grep不带|或其他命令的命令awk?
是否有grep -P一些其他参数仅用于打印匹配模式,\K([\w]+)例如结果是274efcc4d8a0e8f61397be46bd4bfa37?或者是否有任何实现可以grep仅获得结果。