AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-34463

Kefka's questions

Martin Hope
Kefka
Asked: 2020-10-09 07:00:59 +0800 CST

我将如何使用 sed 和/或 awk/grep 来编辑匹配字符串后面的行?

  • 5

我有一个需要一些更改的大文本文件。为此,我需要首先找到具有特定公共字符串的行,然后直接编辑该行。例如,如果我运行这个grep命令:

# grep -A1 important_string gianttextfile.txt
important_string
change_this

我想先定位important_string,然后change_this在整个文档中多次修改为其他内容。我不能只修改所有change_this条目,因为它们中的许多条目需要保持原样,我需要更改的只是这个特定字符串后面的条目。

实现这一目标的最佳方法是什么?

linux sed
  • 1 个回答
  • 110 Views
Martin Hope
Kefka
Asked: 2019-11-29 11:29:56 +0800 CST

在具有非 Optimus 专用 Nvidia GPU 的笔记本电脑上,如何强制应用程序使用它而不是 CPU?

  • 7

我有一台带有 Nvidia RTX 2060 和英特尔 i7-9750H 的新笔记本电脑,运行 Fedora 31 KDE spin。我一直毫无问题地使用 Fedora,尽管以前从未使用专用 GPU。我已经从 rpmfusion 安装了专有的 nvidia 驱动程序,它似乎可以被识别,尽管 CPU 似乎正在处理所有的图形工作,我不知道该怎么做。据我所知,这不是 Optimus 显卡,所以我不能使用 bumblebee/optirun 从 cpu 切换到 gpu 图形(如果有办法选择性地使用这样的卡,尽管我全神贯注,那就是成为理想的解决方案)。

我能想到的所有相关信息(或被谷歌告知是相关的)都在下面。我不知道从这里做什么。我将提供所要求的任何相关后续信息。

相关 lspci 输出:

[root@bulbasaur ~]# lspci -v|grep VGA
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2060 Mobile] (rev a1) (prog-if 00 [VGA controller])

glxinfo 输出:

[root@bulbasaur ~]# glxinfo |grep render
direct rendering: Yes
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
    GLX_MESA_query_renderer, GLX_MESA_swap_control, GLX_OML_swap_method, 
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2) 
    GL_ARB_compute_shader, GL_ARB_conditional_render_inverted, 
    GL_NV_conditional_render, GL_NV_depth_clamp, 
    GL_ARB_compute_shader, GL_ARB_conditional_render_inverted, 
    GL_NV_conditional_render, GL_NV_depth_clamp, GL_NV_fog_distance, 
    GL_EXT_read_format_bgra, GL_EXT_render_snorm, GL_EXT_robustness, 
    GL_NV_conditional_render, GL_NV_draw_buffers, GL_NV_fbo_color_attachments, 
    GL_OES_element_index_uint, GL_OES_fbo_render_mipmap,

nvidia-settings 的屏幕截图,左侧没有显示 XWindows 项目:

https://i.imgur.com/ddRuFsz.png

glmark2 输出:

    glmark2 2017.07
    OpenGL Information
    GL_VENDOR:     Intel Open Source Technology Center
    GL_RENDERER:   Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2) 
    GL_VERSION:    3.0 Mesa 19.2.4

我在 Google 上找到的解决方案之一是将 nvidia.conf 复制到 /etc,我这样做如下:

# cp /usr/share/X11/xorg.conf.d/nvidia.conf /etc/X11/xorg.conf.d/

并添加Option "PrimaryGPU" "yes"我所做的行,但没有效果:

        [root@bulbasaur xorg.conf.d]# cat nvidia.conf
        #This file is provided by xorg-x11-drv-nvidia
        #Do not edit

        Section "OutputClass"
                Identifier "nvidia"
                MatchDriver "nvidia-drm"
                Driver "nvidia"
                Option "AllowEmptyInitialConfiguration"
                Option "SLI" "Auto"
                Option "BaseMosaic" "on"
        EndSection

        Section "ServerLayout"
                Option "PrimaryGPU" "yes"
                Identifier "layout"
                Option "AllowNVIDIAGPUScreens"
        EndSection
linux fedora
  • 1 个回答
  • 1158 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve