如题:
文件路径:/etc/X11/xorg.conf
文件内容:
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 1.0 (mockbuild@builder.wilsonet.com) Wed Apr 28 18:27:01 EDT 2010
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 1.0 (mockbuild@) Sun Feb 28 14:49:02 EST 2010
### Touch Configuration Beginning ###
### Touch Configuration End ###
Section "ServerLayout"
InputDevice "EETI" "SendCoreEvents"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
FontPath "/usr/share/fonts/default/Type1"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from data in "/etc/sysconfig/keyboard"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbLayout" "us"
Option "XkbModel" "pc105"
EndSection
Section "InputDevice"
Identifier "EETI"
Driver "egalax"
Option "Device" "/dev/ttyS2"
Option "Parameters" "/var/lib/eeti.param"
Option "ScreenNo" "0"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Envision EFT7x0 Series"
HorizSync 30.0 - 72.0
VertRefresh 50.0 - 160.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "ION"
Option "Nologo" "TRUE"
EndSection
Section "Screen"
# Removed Option "metamodes" "CRT: nvidia-auto-select +0+0, DFP: nvidia-auto-select +1024+0"
# Removed Option "metamodes" "CRT: nvidia-auto-select +0+0, DFP: 1024x768 +1024+0"
# Removed Option "metamodes" "CRT: nvidia-auto-select +0+0, DFP: 1280x720 +1024+0"
# Removed Option "metamodes" "CRT: nvidia-auto-select +0+0, DFP: NULL"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "1"
Option "TwinViewXineramaInfoOrder" "CRT-0"
Option "metamodes" "CRT: 1024x768 +0+0, DFP: 1024x768 +1024+0" //修改这行。
SubSection "Display"
Depth 24
EndSubSection
EndSection
11 个解决方案
#1
原来的内容是什么 修改成什么?
使用sed 先匹配 再替换
使用sed 先匹配 再替换
#2
主席,我又见到你了。!
#3
红色部分,我想用脚本修改红色部分,就是把分辨率改下。!
我对.sh没认识,
所以请大家,贴代码外家点小注释那就最好不过了,谢谢了。
我对.sh没认识,
所以请大家,贴代码外家点小注释那就最好不过了,谢谢了。
#4
不错啊!
#5
我的意思是你要改这行的那点内容
改成什么
比如把1024x768改成1000x8000
则sed -i -e "s/1024x768/1000x800/g" /etc/X11/xorg.conf
先备份 再测试
改成什么
比如把1024x768改成1000x8000
则sed -i -e "s/1024x768/1000x800/g" /etc/X11/xorg.conf
先备份 再测试
#6
Option "metamodes" "CRT: 1024x768 +0+0, DFP: 1024x768 +1024+0"
你的这个做法会不会把两个都改掉?
#7
Option "metamodes" "CRT: 1024x768 +0+0, DFP: 1024x768 +1024+0"
你的这个做法会不会把两个都改掉?
-----------------------
会 所以我问你替换哪个位置的字符嘛 你还是不说!你要问问题 首先得把问题说清楚!
比如CRT: 1024x768 改成CRT: 1000x8000
则sed -i -e "s/CRT: 1024x768/CRT: 1000x800/g" /etc/X11/xorg.conf
你的这个做法会不会把两个都改掉?
-----------------------
会 所以我问你替换哪个位置的字符嘛 你还是不说!你要问问题 首先得把问题说清楚!
比如CRT: 1024x768 改成CRT: 1000x8000
则sed -i -e "s/CRT: 1024x768/CRT: 1000x800/g" /etc/X11/xorg.conf
#8
对不起啦,
再问下,能否给.sh传参数,我要替换的字符,在程序里是变量,要替换掉的字符也是在程序里是变量。
能否给我个.sh
小弟不是很懂这个。
#9
test.sh
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#!/bin/sh
if [ $# -ne 2 ];then
echo "Usage:$0 FROM TO"
exit 1
fi
sed -i -e 's/'"$1"'/'"$2"'/g' /etc/X11/xorg.conf
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#10
test.sh
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#!/bin/sh if [ $# -ne 2 ];then echo "Usage:$0 FROM TO" exit 1 fi sed -i -e 's/'"$1"'/'"$2"'/g' /etc/X11/xorg.conf
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#11
谢了,老哥,我先去研究下,
常联系。!
#1
原来的内容是什么 修改成什么?
使用sed 先匹配 再替换
使用sed 先匹配 再替换
#2
主席,我又见到你了。!
#3
红色部分,我想用脚本修改红色部分,就是把分辨率改下。!
我对.sh没认识,
所以请大家,贴代码外家点小注释那就最好不过了,谢谢了。
我对.sh没认识,
所以请大家,贴代码外家点小注释那就最好不过了,谢谢了。
#4
不错啊!
#5
我的意思是你要改这行的那点内容
改成什么
比如把1024x768改成1000x8000
则sed -i -e "s/1024x768/1000x800/g" /etc/X11/xorg.conf
先备份 再测试
改成什么
比如把1024x768改成1000x8000
则sed -i -e "s/1024x768/1000x800/g" /etc/X11/xorg.conf
先备份 再测试
#6
Option "metamodes" "CRT: 1024x768 +0+0, DFP: 1024x768 +1024+0"
你的这个做法会不会把两个都改掉?
#7
Option "metamodes" "CRT: 1024x768 +0+0, DFP: 1024x768 +1024+0"
你的这个做法会不会把两个都改掉?
-----------------------
会 所以我问你替换哪个位置的字符嘛 你还是不说!你要问问题 首先得把问题说清楚!
比如CRT: 1024x768 改成CRT: 1000x8000
则sed -i -e "s/CRT: 1024x768/CRT: 1000x800/g" /etc/X11/xorg.conf
你的这个做法会不会把两个都改掉?
-----------------------
会 所以我问你替换哪个位置的字符嘛 你还是不说!你要问问题 首先得把问题说清楚!
比如CRT: 1024x768 改成CRT: 1000x8000
则sed -i -e "s/CRT: 1024x768/CRT: 1000x800/g" /etc/X11/xorg.conf
#8
对不起啦,
再问下,能否给.sh传参数,我要替换的字符,在程序里是变量,要替换掉的字符也是在程序里是变量。
能否给我个.sh
小弟不是很懂这个。
#9
test.sh
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#!/bin/sh
if [ $# -ne 2 ];then
echo "Usage:$0 FROM TO"
exit 1
fi
sed -i -e 's/'"$1"'/'"$2"'/g' /etc/X11/xorg.conf
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#10
test.sh
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#!/bin/sh if [ $# -ne 2 ];then echo "Usage:$0 FROM TO" exit 1 fi sed -i -e 's/'"$1"'/'"$2"'/g' /etc/X11/xorg.conf
./test.sh "CRT: 1024x768" "CRT: 1000x800"
#11
谢了,老哥,我先去研究下,
常联系。!