小编Bab*_*yan的帖子

`uniq -t` 做了什么?

我有一些 2003 年的旧代码,它使用命令-t选项uniq。它引发错误,因为该选项可能不再受支持。

这是使用命令的部分:

egrep -n "{ IA32_OP" ia32-decode.c | \
    awk '{ print $1 $3 $4 }' | \
    sort -t '(' +1 | \
    uniq -t ':' -f 1 | \
    sed 's/\(.*\)\:IA32_OP(\(.*\)),/#define IA32_OP_\2 \1/g' >> ia32_opcodes.h
Run Code Online (Sandbox Code Playgroud)

当时那个选项有什么作用?我可以用什么代替该命令?

uniq

15
推荐指数
1
解决办法
3246
查看次数

启用 systemd-backlight@intel_backlight 而不是 systemd-backlight@acpi_video0

我有 2 个文件/sys/class/backlight/-acpi_video0intel_backlight. intel_backlight是控制我的屏幕亮度(回声/猫)的acpi_video0那个,但是是默认设置。

默认情况下,该服务systemd-backlight@acpi_video0.service是启用的,它应该在关机/启动时保存/恢复亮度,但它不起作用,因为它指向错误的文件。

尝试启用时systemd-backlight@intel_backlight.service,我收到以下消息:

The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has …
Run Code Online (Sandbox Code Playgroud)

arch-linux systemd

6
推荐指数
1
解决办法
7424
查看次数

如何在命令输出末尾添加带空格的字符串

我想在ls命令输出的每一行末尾添加一个带空格的字符串。

#!/bin/sh
STRING_WITH_SPACES="this should be at the end of output"
ls -lh | sed 's|$| '$STRING_WITH_SPACES'|'
Run Code Online (Sandbox Code Playgroud)

$STRING_WITH_SPACES没有空格时,上面的脚本工作正常:

-rw-r--r-- 1 me users 0 May  4 14:55 testfile thisshouldbeattheend
Run Code Online (Sandbox Code Playgroud)

但是,当$STRING_WITH_SPACESsed 中有空格时会抱怨:

sed: -e expression #1, char 9: unterminated `s' command
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

sed string whitespace

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

标签 统计

arch-linux ×1

sed ×1

string ×1

systemd ×1

uniq ×1

whitespace ×1