admin 发表于 2019-6-6 20:11:42

课程第25次

替换文本:
# perl -i -pe 's,cat,dog,g'1.txt
# cat 1.txt
dog
dog dog
dog
# sed -i.bak 's/dog/fish/g' 1.txt
# ls
1.txt            Desktop    initial-setup-ks.cfgPublic   Videos
1.txt.bak      DocumentsMusic               README
anaconda-ks.cfgDownloadsPictures            Templates
# cat 1.txt.bak
dog
dog dog
dog
# cat 1.txt
fish
fish fish
fish

# sed -i.bak '1,2s/fish/cow/g' 1.txt
# vim 1.txt
# cat 1.txt
cow
cow cow
fish

cow
lion lion
fish
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
:2,2s#sheep#lion#g   # /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1       5       cron.daily            nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45   cron.monthly            nice run-parts /etc/cron.monthly
0       3       mycmd                   echo $(date) >>/root/anacron.txt
~



页: [1]
查看完整版本: 课程第25次