我刚刚安装了 Ubuntu 22.04 LTS。它工作正常,但在我暂停会话后,重新启动会话后屏幕仍然黑屏。
我该如何解决?
谢谢
我有一堆具有相同扩展名的文件(比如 .txt),我想将它们连接起来。我正在使用cat *.txt > concat.txt
,但我想在每个文件之间添加一个新行,以便在 concat.txt 中区分它们。
是否有可能用一个单一的bash命令,而不是这样的实现做这个?
谢谢
我正在使用 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)