[GLLUG] using sed
Matt Graham
danceswithcrows@usa.net
Thu, 30 Jan 2003 16:39:25 -0500
On Thursday 30 January 2003 16:31, after a long battle with technology,
RJ Clark wrote:
> I dont know if anyone knows how sed works
Such confidence! Many people on this list know at least the rudiments
of sed.
> sed -e 's/GLcore/glx/g' /etc/X11/XF86Config-4 > /etc/X11/XF86Config-4
sed typically operates on its standard input, applying whatever is in
its -e arguments to all the lines in stdin, then outputting them to
stdout. You don't want to try to overwrite a file in place. You want
something more like this:
cd /etc/X11
sed -e 's/GLcore/glx/g' < XF86Config-4 > temp
mv XF86Config-4 XF86Config-4.old
(always back up important config files, even if you are experienced)
mv temp XF86Config-4
> so if there is a better way to edit or any help would be great
TMTOWTDI, after all.
perl -pe 's/GLcore/glx/g' < XF86Config > XF86Config.temp
mv XF86Config.temp XF86Config
nedit /etc/X11/XF86Config
Edit->Find&Replace-> "GLcore -> glx"-> Replace All
File->Save
vim /etc/X11/XF86Config
:%s/GLcore/glx/g
:wq
...sed is useful and it's always there, but it is not always the best
approach for all situations. HTH,
--
"We should have a policy against using personal resources for company
business." "The Company didn't pay for these pants, so I'm taking
them off at the door!" --J. Moore and A. DeBoer, the Monastery
There is no Darkness in Eternity/But only Light too dim for us to see