ubuntu, ror, jQuery, css, website memo
太嫩, 沒啥心得, 用來紀錄每天學的
2009年4月18日 星期六
apache cache 常用的static file
Apache Web Server Cache Frequently Used Files To Improve Performance
Linux / Unix Command: sed
Does Linux Have a Search & Replace Feature?
#找到 /var/www/domain.com/kb 底下全部的 file 不包含目錄, 在前面加上 mmapfile 的字串, 把這些弄成 /etc/httpd/conf.d 的file
# 那個 & 可以代表match 的部份
find /var/www/domain.com/kb/ -type f -print | sed -e 's/.*/mmapfile &/' > /etc/httpd/conf.d/mmap.conf
cat filename | sed -n '/1024/p'
#Here, sed filters the output from the cat command. The option "-n" tells sed to block all the incoming lines but those explicitly matching the expression. The sed action on a match is "p"= print.
cat filename | sed '/.*o$/d' > new_file
In this EXAMPLE, lines ending with an "o" will be deleted. It uses a regular expression for matching any string followed by an "o" and the end of the line. The output (i.e., all lines but those ending with "o") is directed to new_file.
#To search and replace, use the sed 's' action, which comes in front of two expressions:
cat filename | sed 's/string_old/string_new/' > newfile
#A shorter form for the last command is:
sed 's/string_old/string_new/' filename > newfile
#To insert text from a text file (text_added.txt) into an html file, you may use a script containing:
sed '/placeholder_text_in_html_file/r text_added.txt'
index_master_file.html > index.html
#EX:delete blank lines and redirect the output
$sed '/^$/d' file > file.out
#Ex: takes input from who command and check whether particular user is logged or not
$who | sed -n '/nix/p'
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言