小编Gig*_*iux的帖子

ubuntu 22.04 暂停后黑屏

我刚刚安装了 Ubuntu 22.04 LTS。它工作正常,但在我暂停会话后,重新启动会话后屏幕仍然黑屏。

我该如何解决?

谢谢

ubuntu suspend screen-lock

14
推荐指数
1
解决办法
1万
查看次数

连接文件,在它们之间放置一个空行

我有一堆具有相同扩展名的文件(比如 .txt),我想将它们连接起来。我正在使用cat *.txt > concat.txt,但我想在每个文件之间添加一个新行,以便在 concat.txt 中区分它们。

是否有可能用一个单一的bash命令,而不是这样的实现做这个

谢谢

files cat newlines

7
推荐指数
5
解决办法
1261
查看次数

如何grep文字'..'

我正在使用 grep 解析文件,屏幕上的输出包含换行符,如下所示:

$ grep 'gene' sequence.gb
     gene            89..1483
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
     gene            complement(1987..2763)
                     /gene="nucleocapsid protein"
                     /gene="nucleocapsid protein"
Run Code Online (Sandbox Code Playgroud)

我可以将它分配给一个变量并用换行符打印出来:

$ gene=$(grep 'gene' sequence.gb)
echo "$gene"
     gene            89..1483
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
     gene            complement(1987..2763)
                     /gene="nucleocapsid protein"
                     /gene="nucleocapsid protein"
Run Code Online (Sandbox Code Playgroud)

但这不包含真正的换行符,因为如果我再次 grep 包含 '..' 的行,我会得到很多:

$ echo "$gene" | grep '..'
     gene            89..1483
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural protein"
                     /gene="non-structural …
Run Code Online (Sandbox Code Playgroud)

grep bash newlines

2
推荐指数
1
解决办法
3179
查看次数

标签 统计

newlines ×2

bash ×1

cat ×1

files ×1

grep ×1

screen-lock ×1

suspend ×1

ubuntu ×1