搞笑避孕套广告
04月 19th, 2008超自信的笑容,会让你忘记一切烦恼
超自信的笑容,会让你忘记一切烦恼
[audio:http://blog.freebug.org/mp3/zj.mp3|autostart=yes]
多远能够走完这世界
感觉放到极限
某天无声的雨正下在某处
我被淋湿了
湿透我想才能更勇敢
等着雨过天晴
忽然想要看彩虹
可以拥抱我
我飞越一阵痛楚的转变
懂的想的就那些
原来那就叫作生命的中间
飞越一滴苦涩的眼泪
雨点下的好直接
发现彩虹在天边
渺小的我跑在最前面
那一边是明天
看见那看不见的时间
当我有了从前
往前发出声音告诉这世界
我想要什么
听见我已经开始冒险
泪水流下安慰
哭过的脸最坚决
放晴的瞬间
我飞越一阵痛楚的转变
懂的想的就那些
原来那就叫作生命的中间
飞越一滴苦涩的眼泪
雨点下的好直接
发现彩虹在天边
渺小的我跑在最前面
那一边是明天
我飞越一阵痛楚的转变
懂的想的就那些
原来那就叫作生命的中间
飞越一滴苦涩的眼泪
雨点下的好直接
发现彩虹在天边
渺小的我跑在最前面
那一边是明天
不远来到一切的中间
转变
会变灰色阴天到晴天
那天
了解像勇气的无意间
出现
生命有许多中间
多年以后,赵敏和周芷若在湖边偶遇。
周芷若正在船中拂琴,看到岸上散步的赵敏,便要家仆把船摇靠岸,上了岸站在赵敏身前。
“赵姑娘,好久不见了。”周之若微微一欠身,向赵敏问了声好。
“哦,周姑娘,你,还是老样子。一点没变。”赵敏本早就认出了周芷若的,只因见周芷若经历风霜丝毫未见老去,而自己却已经和无忌隐居山野,一副村妇的模样,相形之下本要逃走的。赵敏想着刚刚周芷若看出了自己转身想走感到有些窘,但转念一想自己是从不曾向别人低过头的,尤其是眼前的周芷若,于是挺直了腰,直视向周芷若的眼睛,问道:“你还好吧。”
“赵姑娘费心了,我一直还好,你和无忌哥哥如何啊?”
赵敏突然觉得有些可怜周芷若了,尽管她现在看起来是绫罗绸缎,衣食无忧,可是一生之中最爱的人始终不在她身边,再好的物质又有什么用呢?此时赵敏觉得自己即便已经不如当年那样春风得意,但是也始终是强过了周芷若的。转念一想怕周芷若还在惦记着无忌,而无忌又是心肠软的人,禁不住周芷若的柔情,于是说道:“我和无忌很好,我们的孩子已经3岁了。周姑娘,你现在可有成家?”
“我,就要成家了。”周芷若羞怯地向船中一看,赵敏顺着她的眼光看去,船中原来还坐着一个男人,这男人见两个女人看向她,便起身走了出来。
“赵姑娘。”男子微一欠身算是行礼,收起手中的扇子,站到了周之若的旁边。
赵敏打量这个男人,他身形修长,一派儒雅之气,站在芷若身边,也确是人见人赞的一对壁人。不由得也赞叹起来。
“赵姑娘,这就是我未来的夫婿,白员外。”周芷若靠向白员外,向赵敏介绍到。
那男子体贴地看像周芷若,温婉地一笑。
赵敏看了有些不是滋味,当初无忌也没有这般柔情,于是酸酸地说了一句:“那么青书呢?”
“青书的事情我都知道,不烦赵姑娘费心了,他以前来时也祝福过我们,希望赵姑娘也能尽释前嫌,”白员外不客气地盯着赵敏,转向芷若说,“我们该回去了。”
“你先回去,我和赵姑娘还有话说。”周芷若看白员外面露难色,又说:“放心吧,我没事。”白员外又看了一眼赵敏,仿佛在警告她不要打什么主意,然后拍了拍芷若的手,这才回到船上,转身又对芷若说:“一会我叫家仆回来接你。”便让家仆摇著船去了。
“我家就在湖那边。”周芷若向赵敏补充道。
“好了,周芷若,别这样装腔作势了,你以前不是这样的。”赵敏发现了周芷若的不对劲,周芷若那里是这样随便自己欺负的人啊,“反正你那个员外已经走了。”
“芷若以前是有很多不对,希望赵姑娘不要忌恨。”
“你难道真的会这样安于现状吗?你不再惦记着张无忌了?”赵敏终于说出了憋了很久的话。
“无忌哥哥,他,还是和你比较合适的。”周芷若面向湖水走了几步,“我曾经也想不通,我和你到底谁更好呢?为什么无忌哥哥会喜欢你?后来我才知道,他不是喜欢谁不喜欢谁,他是个没有主见的人,男人都是他的兄弟,他讲义气,但是对女人,无忌哥哥丝毫没有头绪。他的情节是小昭不是吗?但是他自己不会判断,只要每天对着他说谁是他喜欢的人,他就会相信,他不是由心去作决定的。他优柔寡断,所以才会由我们这些人,你,我,小昭,殷离,我们之间不停的较量,而你最聪明,你懂得要抓住他。你知道怎么控制他,所以他也就注定要和你在一起。”
“周姑娘……”赵敏没想到周芷若会说出这些话。
“也许,世人会对我们各自评述,但是这又能怎么样呢?世人也都是希望你们能够走到一起的。赵姑娘,我钦佩你,你是为你自己活着的,你毫无顾忌,而我,我是始终活在挣扎之中的。”
“我曾经活得没有自己,我为了师傅活着,活在她的阴影里,因为那句毒誓,我和无忌哥哥在一起时总是有负担,因为光耀峨嵋的使命,我害了殷离,害了你,害了无忌哥哥,害了金毛狮王,也害了自己。这都是宿命。我曾经总是和你比,我想你残害过六大门,你压迫着汉人,你为了和无忌哥哥双宿双飞,你搅了我们的婚礼,你做了那么多我接受不了的事情,你甚至欺骗了无忌哥哥,让他离开了明教。我只不过是陷害了一个妖女,我没有你做的坏事多,为什么无忌哥哥甘愿和你在一起?后来我才知道,人和人是不一样的,你做的那些,你不会去后悔,不会觉得错,而我,我日日夜夜为了这件事情不能安寝,这件事情成了我心中的魔,你毫无负担,而我,却走得那么辛苦。”
“你是说我不知廉耻,做了坏事也不愧疚了?”赵敏有些不悦。
“不是,赵姑娘,”芷若忙辩解:“我是说你活的潇洒,活的自我,为了自己活着,我是羡慕你。你和无忌哥哥成婚是我知道,我也想象你当初那样用无忌哥哥答应我的那个条件逼你们不能成婚,但是我做不到,我知道,如果我做了,我会日日夜夜觉得对不起无忌哥哥,对不起你。我们三个都会痛苦,实在是没有必要那样做。”
“当初我还真怕你来搅我们呢,不瞒你说,我想了好多说辞来对付你,你没来,我还有一些失落呢。”赵敏看周芷若是真的放下了过去的事情,也放开了说起话来。
“赵姑娘,你总是争强好胜的,所以你能成一番大事,即便只是为人妻子,也是个有自我的妻子,而我,我的性格注定了我要这样平淡安详得过一辈子了。赵姑娘,我好羡慕你。”
“芷若,你把我说得太好了,其实,我们也许是可以做好姐妹的,我以前的确有对不起你的地方,你不会怪我吧?”
“怎么会呢,你看我现在,像是还会计较纠缠的人吗?只是咱们各在大江南北,像这样的偶遇,恐怕也是最后的缘分了。”
“芷若……”赵敏心中突有一丝不舍。
这时,船又摇了回来,芷若拉着赵敏的手,说:“后会有期吧,”转身,上了船。
赵敏看着越摇越远的船,心情难以平静。
“芷若,”白员外还是在船上,静静地看着芷若。
“义兄,刚刚谢谢你了。”
“唉,当初为了让青书死心,你不也是拉我做冒牌的丈夫。只是,我没有做你真丈夫的福气。芷若,我们……”
“义兄,芷若今生不想再论及感情了。”
“你还是放不下张无忌?”
“这也许是我这辈子唯一的执著了……”
1.牛拦织女 (拦路抢劫??劫色??)
2.龟头赛跑 (资源紧张啊!)
3.盘古开苞 (遥远的梦想,我也想)
4.女娲补锅 (原来女娲也喜欢湘剧啊)
5.罗密欧煮你爷 (快打110,叫你爷快跑啊)
6.梁山伯揍英台 (家庭暴力的典型案例)
7.猪八戒背黑锅 (习惯了)
8.包工头林冲 (林冲也下海??)
9.牛郎侄女 (侄女也行啊?)
10.天国的内衣 (什么牌子的啊??)
11.新白娘子玩传奇 (什么职业?多少级了?哪个区??)
12.后羿爱猫扑.爱生活 (看你能射多少)
13.九屎一身 (恶心)
14.王刚罚款 (谁叫你乱砍乱伐)
15.七仙女坐台 (多少钱一个啊?)
16.贵妃出狱 (无罪释放)
17.倩女幽会 (和谁啊??怕怕)
18.做一天和尚撞一天车(阿弥佗佛,悲惨悲惨)
19.脱了鞋子抽别人嘴巴(做错了事还怪别人啊)
20.蒂大吾勃 (牛X)
21.降龙十巴掌 (痛)
22.天生我崽必有病 (不知道怎么说,无语)
23.船到桥头自然沉 (潜艇???) 撞到桥头当然沉 (废话!!)
24.临死抱佛脚 (死还要拉个垫背的)
25.福尔牌摩丝 (哪里产的?福尔摩斯用的吗?)
26.名侦探可烂 (叼)
27.嫦娥奔丧 (王刚还是后羿挂了??)
28.黑B 00544 (我的车牌) 牛B 74110 (我朋友的车牌)
29.索尼爱寄信 (sonyericsson??)
30.久旱逢沐浴露 (不会又是雕牌吧?)
Linux Channel Bonding可以支持把多个网络适配器集合在一起, 当作一个网络适配器来使用。在 Linux 下,网卡的高可用性是通过 MII 或者 ETHTOOL 的状态监测来实现的,所以,需要检查系统中的网络适配器是否支持 MII 或者ETHTOOL 的连状态监测。可以用命令 “ethtool eth0″ 来检查,如果显示的 “Link detected:” 信息与实现的连接状态一致,就没有问题。如果系统中的网络适配器不支持 MII 或者 ETHTOOL 状态监测,当连接失效时,系统就不能检测到,同时,在 bonding 驱动加载时,会记录一条不支持 MII 和 ETHTOOL 的警告信息。
环境: Red Hat Enterprise Linux 4 Update1
解决方法:
RHEL支持在内核级实现将多个物理网卡帮定为一个逻辑bonding设备,通过把多个物理网卡帮定为一个逻辑设备,可以实现增加带宽吞吐量,提供冗余。
为了创建一个bonding设备,在/etc/sysconfig/network-scripts/下创建文件ifcfg-bond<N>,N是一个数字,例如0。
该文件内容对不同类型网卡的帮定都是一样的,例如以太设备。唯一的区别是DEVICE=应该是bond<N>,下面是一个示例文件:
DEVICE=bond0 BOOTPROTO=none ONBOOT=yes NETWORK=10.0.1.0 NETMASK=255.255.255.0 IPADDR=10.0.1.27 USERCTL=no
一旦创建了bonding接口,bonding设备包含的网卡设备必须进行配置,在配置文件中添加到MASTER=和SLAVE=,所有网卡的配置文件都是类似的,例如一个bonding设备帮定了两个网卡,eth0和eth1的配置文件可能如下:
DEVICE=eth<N> BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no
在本例中,把<N>替换为网卡编号。
为了激活bonding设备,必须加载内核模块,在RHEL4和RHEL3下加载模块的过程稍有不同。
RHEL4
为了确保在bonding设备在启动时模块被加载,在/etc/modprobe.conf中添加如下内容:
install bond<N> /sbin/modprobe bonding -o bond<N> miimon=100 mode=0
替换<N>为设备编号,例如0。
miimon 是指多久时间检查网络一次,单位是ms(毫秒),其意义是假设其中有一条网络断线,会在0.1秒内自动备援
mode 共有七种模式(0~6)
mode=0:负载均衡模式,有自动备援,但需要”Switch”支持和设定。
mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援。
mode=6:负载均衡模式,有自动备援,不需要”Switch”支持和设定。
如果还要使用互备模式,需要加上参数primary=ethx
对于每个虚拟bonding设备,在/etc/modprobe.conf中都要有对应行。需要注意的是在RHEL4U2之前的版本,不支持多个bonding设备。如果需要配置多个bonding设备,则需要升级内核到 RHEL4U2。
一旦/etc/modprobe.conf被配置,bonding虚拟设备配置文件以及网卡配置文件配置完毕,ifup命令将用来启动bonding虚拟设备,或者通过重新起动网络。
vi /etc/sysctl.conf
新增如下内容:
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syncookies=1
使内核参数生效:
[root@web02 ~]# sysctl -p
readme:
net.ipv4.tcp_syncookies=1 打开TIME-WAIT套接字重用功能,对于存在大量连接的Web服务器非常有效。
net.ipv4.tcp_tw_recyle=1
net.ipv4.tcp_tw_reuse=1 减少处于FIN-WAIT-2连接状态的时间,使系统可以处理更多的连接。
net.ipv4.tcp_fin_timeout=30 减少TCP KeepAlive连接侦测的时间,使系统可以处理更多的连接。
net.ipv4.tcp_keepalive_time=1800 增加TCP SYN队列长度,使系统可以处理更多的并发连接。
net.ipv4.tcp_max_syn_backlog=8192
1、
70后:工作狂基本上都是70后的。
80后:而我们,拒绝加班!
90后:拒绝上班!
2、
70后:他们喜欢穿七匹狼或者猛龙牌子的衣服。
80后: 我们喜欢G-Star之类的。
90后:乞丐服,越花越好,越破越好…一个洞时尚,两个洞潮流,三个洞个性…
3、
70后:他们唱k的时候只会乱吼──例如2002年的第一场雪,然后就拼命拉着你喝酒,不让你唱。
80后:Mic霸一般是我们。
90后:我们不止会唱,还会跳!
4、
70后:他们的话题除了工作就是股票。
80后:我们的话题更多,有英超魔兽……
90后:QQ等级,QQ秀…
5、
70后:他们如果有笔记本,会喜欢到公众场合用。
80后:我们才不会背那么重的东西在身上。
90后:只要苹果笔记本,而且不止一台…
6、
70后:他们喜欢喝红酒,一般是长城红酒。
80后:我们要么不喝酒,要么就喝啤酒。
90后:韩国果汁,日本汽水…
7、
70后:他们无论任何时候,看到有站着的领导,都会马上给领导让座。
80后:我们崇尚上下级平等。
90后:天上地下,唯我独尊!
8、
70后:他们娶老婆的时候想娶处女。
80后:我们觉得无所谓,只要相互感情好就可以了。
90后:结婚需要感情吗?..需要结婚吗?..
9、
70后:他们觉得每个日本人美国人台湾人都想攻打中国。
80后:我们喜欢日本的连续剧台湾的综艺节目美国的大片。
90后:我要去日本,因为我是日系MM…
10、
70后:他们希望中国用核弹把上面三个国家(地区)都灭了。
80后:我们希望和平。
90后:和我无关!打仗衣服会降价吗?那就打呗~~
11、
70后:他们对服务员态度恶劣,或者言语上调戏女服务员。
80后:我们只在点菜和结帐时会跟服务员说话。
90后:从不和waitress说话,只会背后讨论她的衣服很土…
12、
70后:他们有存款。
80后:我们负债。
90后:我们有老爸!
13、
70后:他们会把房子买在番禺或者花都,然后每天早上花一个多小时乘车去上班。
80后:我们喜欢在公司附近租房子,每天骑车或走路去上班,就为了早上多睡一会。
90后:我们住哪里都可以,只要BF喜欢…
14、
70后:他们结交有背景有地位的人。
80后:我们结交志趣相投的人。
90后:我们结交满身文身的帅哥!
15、
70后:他们周末约客户去吃饭。
80后:我们周末约同学去踢球。
90后:一个礼拜7天周末,想做什么做什么!
16、
70后:他们喝酒时喜欢跟别人干杯
80后:我们能喝多少喝多少,喝不下了,怎么也不肯再喝
90后:我不是随便喝酒的人,我随便喝起酒来不是人~
17、
70后:他们的家进门要脱鞋。
80后:我们家进门不用脱鞋。
90后:我们上床睡觉都不脱鞋!
18、
70后:他们五一国庆去旅游,然后会在各个景点门口拍下很多V字手势的照片。
80后:我们五一国庆在家睡觉,或者约朋友去唱k,去旅游,我们只会拍景色。
90后:我们天天是五一,国庆….取消五一,么关系…
19、
70后:吃饭时,他们喜欢坐在老板旁边
80后:我们最好别坐在老板旁边,那才无拘无束
90后:我是老板!
20、
70后:他们跟陌生人在一起的时候喜欢找话题说。
80后:我们不太搭理陌生人,故意找话题不累么?
90后:你谁阿,穿这么土,死开~ 帅哥,交个朋友好嘛?~~
[audio:http://blog.freebug.org/mp3/fzl.mp3|autostart=yes]
这是一对狗男女(哦不!)非主流男女之间的一次对话。
他们在网络上勾搭了(哦不!)在网络上相识了。
后来上演了一段浪漫的爱情闹剧(哦不!)爱情韩剧。
= =。 本故事纯属虚构 如有雷同 太刺激了。。。
合:
偶素非主流 偶非常滴口耐
你有米有听到偶讲话都很奇怪
某男子:
表招惹偶哦 偶素某帮派滴
小心偶和(han)偶滴兄弟去T你滴pp
合:
偶素非主流 偶非常滴口耐
你有米有看到偶打扮都很奇怪
某女子:
表欺负偶哦 偶素某家族滴
小心偶劲舞里亲耐滴会T你滴PP
某男子:
MM丫~初次见面
偶看到你滴空间有好多漂漂片片
你有米有看到偶给你滴留言?
偶素不素可以约你出来见个面?
某女子:
GG丫~呼呼~你真讨厌~
其实偶早就去过你滴空间
早知道你滴昵称叫做“某男子”
真的好巧,偶滴昵称叫做“某女子”
某男子:
MM快点打开视频 让偶看看你
偶坐在这里聊天聊得有点等不及
其实。。偶素真滴一直稀饭你
最稀饭滴就是你用繁体字讲话滴语气
某女子:
好勒啦~给你看 偶今天涂了新的腮红
偶稀饭用眼线液涂黑色的眼影
GG 好稀饭你嘴上那个黑色唇钉
不知道偶们如果接吻的话 你会不会疼?
某男子:
不会勒啦~这样比较非主流~
偶今天刚刚烫了亚麻色的锡纸头
你看 偶这边的耳朵上有十七个耳洞
偶十七岁滴生日穿滴 一点也不疼
某女子:
哇哦~GG哦~你真滴好帅~
偶看你到玩劲舞也跳得好快~
好稀饭哦。。。偶有点想做耐~
不知道你素不素那个也会很快~
某男子:
才不会勒啦~人家那个好厉害
不如今晚咱们见面偶真的非常期待
偶会带着相机做耐时候拍拍
ps以后发到偶们空间里来
某女子:
讨厌勒啦~GG你真的好坏~
米有七百万像素滴相机才不跟你拍拍
偶先说好 偶不素个随便滴人哦
你以后只许爱偶一个 要写在资料里哦
话外音:
MC良良:
于是 这俩个SB 就这样见了面
然后一起到某个旅馆里面开了一个房间
后来发生的事情 说不说都随便
反正每天都有类似的事情发生在你身边
这只是一个故事 俩主角都没有素质
中学还没毕业 就缺得不像样子
如果我有这样的孩子我一定会很伤心
所以我打心里很想去问候他们的母亲
我并没有打算让这个故事发人深省
我也不会缺到去泡非主流的女生
文化没有 素质没有 还搞虾米非主流
= =。 拜托 一个一个简直都是小丑
jing:
eh fucken.
你是非主流还是飞主流
u better check them out.
these little kids are Non-mainstream?
come on they look like circus chicks.
are u guys trying to be a Acrobatic Troupe
or is it me just thinking too much.
If u love body peircing soo much
then let me give u a suggestion,
how bout get a peircing on ur butt crack.
whats it suppose to call?
a butt crack peirce? (hahaha …)
my mom didnt tought me very well enough to
be a gentle lady.
but atlease we know the difference between clowns
go take a look urself in the merrior.
what do u see?
u see a clown.
HANDY ONE-LINERS FOR SED (Unix stream editor) Mar. 23, 2001
compiled by Eric Pement <pemente@northpark.edu> version 5.1
Latest version of this file is usually at:
http://www.student.northpark.edu/pemente/sed/sed1line.txt
http://www.cornerstonemag.com/sed/sed1line.txt
This file is also available in Portuguese at:
http://www.lrv.ufsc.br/wmaker/sed_ptBR.html
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed ’/^$/d;G’
# triple space a file
sed ’G;G’
# undo double-spacing (assumes even-numbered lines are always blank)
sed ’n;d’
NUMBERING:
# number each line of a file (simple left alignment). Using a tab (see
# note on ’\t’ at end of file) instead of space will preserve margins.
sed = filename | sed ’N;s/\n/\t/’
# number each line of a file (number on left, right-aligned)
sed = filename | sed ’N; s/^/ /; s/ *\(.\{6,\}\)\n/\1 /’
# number each line of file, but only print numbers if line is not blank
sed ’/./=’ filename | sed ’/./N; s/\n/ /’
# count lines (emulates ”wc -l”)
sed -n ’$=’
TEXT CONVERSION AND SUBSTITUTION:
# IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
sed ’s/.$//’ # assumes that all lines end with CR/LF
sed ’s/^M$//’ # in bash/tcsh, press Ctrl-V then Ctrl-M
sed ’s/\x0D$//’ # gsed 3.02.80, but top script is easier
# IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format
sed ”s/$/`echo -e \\\r`/” # command line under ksh
sed ’s/$’”/`echo \\\r`/” # command line under bash
sed ”s/$/`echo \\\r`/” # command line under zsh
sed ’s/$/\r/’ # gsed 3.02.80
# IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format
sed ”s/$//” # method 1
sed -n p # method 2
# IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
# Cannot be done with DOS versions of sed. Use ”tr” instead.
tr -d \r <infile >outfile # GNU tr version 1.22 or higher
# delete leading whitespace (spaces, tabs) from front of each line
# aligns all text flush left
sed ’s/^[ \t]*//’ # see note on ’\t’ at end of file
# delete trailing whitespace (spaces, tabs) from end of each line
sed ’s/[ \t]*$//’ # see note on ’\t’ at end of file
# delete BOTH leading and trailing whitespace from each line
sed ’s/^[ \t]*//;s/[ \t]*$//’
# insert 5 blank spaces at beginning of each line (make page offset)
sed ’s/^/ /’
# align all text flush right on a 79-column width
sed -e :a -e ’s/^.\{1,78\}$/ &/;ta’ # set at 78 plus 1 space
# center all text in the middle of 79-column width. In method 1,
# spaces at the beginning of the line are significant, and trailing
# spaces are appended at the end of the line. In method 2, spaces at
# the beginning of the line are discarded in centering the line, and
# no trailing spaces appear at the end of lines.
sed -e :a -e ’s/^.\{1,77\}$/ & /;ta’ # method 1
sed -e :a -e ’s/^.\{1,77\}$/ &/;ta’ -e ’s/\( *\)\1/\1/’ # method 2
# substitute (find and replace) ”foo” with ”bar” on each line
sed ’s/foo/bar/’ # replaces only 1st instance in a line
sed ’s/foo/bar/4′ # replaces only 4th instance in a line
sed ’s/foo/bar/g’ # replaces ALL instances in a line
sed ’s/\(.*\)foo\(.*foo\)/\1bar\2/’ # replace the next-to-last case
sed ’s/\(.*\)foo/\1bar/’ # replace only the last case
# substitute ”foo” with ”bar” ONLY for lines which contain ”baz”
sed ’/baz/s/foo/bar/g’
# substitute ”foo” with ”bar” EXCEPT for lines which contain ”baz”
sed ’/baz/!s/foo/bar/g’
# change ”scarlet” or ”ruby” or ”puce” to ”red”
sed ’s/scarlet/red/g;s/ruby/red/g;s/puce/red/g’ # most seds
gsed ’s/scarlet\|ruby\|puce/red/g’ # GNU sed only
# reverse order of lines (emulates ”tac”)
# bug/feature in HHsed v1.5 causes blank lines to be deleted
sed ’1!G;h;$!d’ # method 1
sed -n ’1!G;h;$p’ # method 2
# reverse each character on the line (emulates ”rev”)
sed ’/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//’
# join pairs of lines side-by-side (like ”paste”)
sed ’$!N;s/\n/ /’
# if a line ends with a backslash, append the next line to it
sed -e :a -e ’/\\$/N; s/\\\n//; ta’
# if a line begins with an equal sign, append it to the previous line
# and replace the ”=” with a single space
sed -e :a -e ’$!N;s/\n=/ /;ta’ -e ’P;D’
# add commas to numeric strings, changing ”1234567″ to ”1,234,567″
gsed ’:a;s/\B[0-9]\{3\}\>/,&/;ta’ # GNU sed
sed -e :a -e ’s/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta’ # other seds
# add commas to numbers with decimal points and minus signs (GNU sed)
gsed ’:a;s/\(^\|[^0-9.]\)\([0-9]\+\)\([0-9]\{3\}\)/\1\2,\3/g;ta’
# add a blank line every 5 lines (after lines 5, 10, 15, 20, etc.)
gsed ’0~5G’ # GNU sed only
sed ’n;n;n;n;G;’ # other seds
SELECTIVE PRINTING OF CERTAIN LINES:
# print first 10 lines of file (emulates behavior of ”head”)
sed 10q
# print first line of file (emulates ”head -1″)
sed q
# print the last 10 lines of a file (emulates ”tail”)
sed -e :a -e ’$q;N;11,$D;ba’
# print the last 2 lines of a file (emulates ”tail -2″)
sed ’$!N;$!D’
# print the last line of a file (emulates ”tail -1″)
sed ’$!d’ # method 1
sed -n ’$p’ # method 2
# print only lines which match regular expression (emulates ”grep”)
sed -n ’/regexp/p’ # method 1
sed ’/regexp/!d’ # method 2
# print only lines which do NOT match regexp (emulates ”grep -v”)
sed -n ’/regexp/!p’ # method 1, corresponds to above
sed ’/regexp/d’ # method 2, simpler syntax
# print the line immediately before a regexp, but not the line
# containing the regexp
sed -n ’/regexp/{g;1!p;};h’
# print the line immediately after a regexp, but not the line
# containing the regexp
sed -n ’/regexp/{n;p;}’
# print 1 line of context before and after regexp, with line number
# indicating where the regexp occurred (similar to ”grep -A1 -B1″)
sed -n -e ’/regexp/{=;x;1!p;g;$!N;p;D;}’ -e h
# grep for AAA and BBB and CCC (in any order)
sed ’/AAA/!d; /BBB/!d; /CCC/!d’
# grep for AAA and BBB and CCC (in that order)
sed ’/AAA.*BBB.*CCC/!d’
# grep for AAA or BBB or CCC (emulates ”egrep”)
sed -e ’/AAA/b’ -e ’/BBB/b’ -e ’/CCC/b’ -e d # most seds
gsed ’/AAA\|BBB\|CCC/!d’ # GNU sed only
# print paragraph if it contains AAA (blank lines separate paragraphs)
# HHsed v1.5 must insert a ’G;’ after ’x;’ in the next 3 scripts below
sed -e ’/./{H;$!d;}’ -e ’x;/AAA/!d;’
# print paragraph if it contains AAA and BBB and CCC (in any order)
sed -e ’/./{H;$!d;}’ -e ’x;/AAA/!d;/BBB/!d;/CCC/!d’
# print paragraph if it contains AAA or BBB or CCC
sed -e ’/./{H;$!d;}’ -e ’x;/AAA/b’ -e ’/BBB/b’ -e ’/CCC/b’ -e d
gsed ’/./{H;$!d;};x;/AAA\|BBB\|CCC/b;d’ # GNU sed only
# print only lines of 65 characters or longer
sed -n ’/^.\{65\}/p’
# print only lines of less than 65 characters
sed -n ’/^.\{65\}/!p’ # method 1, corresponds to above
sed ’/^.\{65\}/d’ # method 2, simpler syntax
# print section of file from regular expression to end of file
sed -n ’/regexp/,$p’
# print section of file based on line numbers (lines 8-12, inclusive)
sed -n ’8,12p’ # method 1
sed ’8,12!d’ # method 2
# print line number 52
sed -n ’52p’ # method 1
sed ’52!d’ # method 2
sed ’52q;d’ # method 3, efficient on large files
# beginning at line 3, print every 7th line
gsed -n ’3~7p’ # GNU sed only
sed -n ’3,${p;n;n;n;n;n;n;}’ # other seds
# print section of file between two regular expressions (inclusive)
sed -n ’/Iowa/,/Montana/p’ # case sensitive
SELECTIVE DELETION OF CERTAIN LINES:
# print all of file EXCEPT section between 2 regular expressions
sed ’/Iowa/,/Montana/d’
# delete duplicate, consecutive lines from a file (emulates ”uniq”).
# First line in a set of duplicate lines is kept, rest are deleted.
sed ’$!N; /^\(.*\)\n\1$/!P; D’
# delete duplicate, nonconsecutive lines from a file. Beware not to
# overflow the buffer size of the hold space, or else use GNU sed.
sed -n ’G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P’
# delete the first 10 lines of a file
sed ’1,10d’
# delete the last line of a file
sed ’$d’
# delete the last 2 lines of a file
sed ’N;$!P;$!D;$d’
# delete the last 10 lines of a file
sed -e :a -e ’$d;N;2,10ba’ -e ’P;D’ # method 1
sed -n -e :a -e ’1,10!{P;N;D;};N;ba’ # method 2
# delete every 8th line
gsed ’0~8d’ # GNU sed only
sed ’n;n;n;n;n;n;n;d;’ # other seds
# delete ALL blank lines from a file (same as ”grep ’.' ”)
sed ’/^$/d’ # method 1
sed ’/./!d’ # method 2
# delete all CONSECUTIVE blank lines from file except the first; also
# deletes all blank lines from top and end of file (emulates ”cat -s”)
sed ’/./,/^$/!d’ # method 1, allows 0 blanks at top, 1 at EOF
sed ’/^$/N;/\n$/D’ # method 2, allows 1 blank at top, 0 at EOF
# delete all CONSECUTIVE blank lines from file except the first 2:
sed ’/^$/N;/\n$/N;//D’
# delete all leading blank lines at top of file
sed ’/./,$!d’
# delete all trailing blank lines at end of file
sed -e :a -e ’/^\n*$/{$d;N;ba’ -e ’}' # works on all seds
sed -e :a -e ’/^\n*$/N;/\n$/ba’ # ditto, except for gsed 3.02*
# delete the last line of each paragraph
sed -n ’/^$/{p;h;};/./{x;/./p;}’
SPECIAL APPLICATIONS:
# remove nroff overstrikes (char, backspace) from man pages. The ’echo’
# command may need an -e switch if you use Unix System V or bash shell.
sed ”s/.`echo \\\b`//g” # double quotes required for Unix environment
sed ’s/.^H//g’ # in bash/tcsh, press Ctrl-V and then Ctrl-H
sed ’s/.\x08//g’ # hex expression for sed v1.5
# get Usenet/e-mail message header
sed ’/^$/q’ # deletes everything after first blank line
# get Usenet/e-mail message body
sed ’1,/^$/d’ # deletes everything up to first blank line
# get Subject header, but remove initial ”Subject: ” portion
sed ’/^Subject: */!d; s///;q’
# get return address header
sed ’/^Reply-To:/q; /^From:/h; /./d;g;q’
# parse out the address proper. Pulls out the e-mail address by itself
# from the 1-line return address header (see preceding script)
sed ’s/ *(.*)//; s/>.*//; s/.*[:<] *//’
# add a leading angle bracket and space to each line (quote a message)
sed ’s/^/> /’
# delete leading angle bracket & space from each line (unquote a message)
sed ’s/^> //’
# remove most HTML tags (accommodates multiple-line tags)
sed -e :a -e ’s/<[^>]*>//g;/</N;//ba’
# extract multi-part uuencoded binaries, removing extraneous header
# info, so that only the uuencoded portion remains. Files passed to
# sed must be passed in the proper order. Version 1 can be entered
# from the command line; version 2 can be made into an executable
# Unix shell script. (Modified from a script by Rahul Dhesi.)
sed ’/^end/,/^begin/d’ file1 file2 … fileX | uudecode # vers. 1
sed ’/^end/,/^begin/d’ ”$@” | uudecode # vers. 2
# zip up each .TXT file individually, deleting the source file and
# setting the name of each .ZIP file to the basename of the .TXT file
# (under DOS: the ”dir /b” switch returns bare filenames in all caps).
echo @echo off >zipup.bat
dir /b *.txt | sed ”s/^\(.*\)\.TXT/pkzip -mo \1 \1.TXT/” >>zipup.bat
TYPICAL USE: Sed takes one or more editing commands and applies all of
them, in sequence, to each line of input. After all the commands have
been applied to the first input line, that line is output and a second
input line is taken for processing, and the cycle repeats. The
preceding examples assume that input comes from the standard input
device (i.e, the console, normally this will be piped input). One or
more filenames can be appended to the command line if the input does
not come from stdin. Output is sent to stdout (the screen). Thus:
cat filename | sed ’10q’ # uses piped input
sed ’10q’ filename # same effect, avoids a useless ”cat”
sed ’10q’ filename > newfile # redirects output to disk
For additional syntax instructions, including the way to apply editing
commands from a disk file instead of the command line, consult ”sed &
awk, 2nd Edition,” by Dale Dougherty and Arnold Robbins (O’Reilly,
1997; http://www.ora.com), ”UNIX Text Processing,” by Dale Dougherty
and Tim O’Reilly (Hayden Books, 1987) or the tutorials by Mike Arst
distributed in U-SEDIT2.ZIP (many sites). To fully exploit the power
of sed, one must understand ”regular expressions.” For this, see
“Mastering Regular Expressions” by Jeffrey Friedl (O’Reilly, 1997).
The manual (”man”) pages on Unix systems may be helpful (try ”man
sed”, ”man regexp”, or the subsection on regular expressions in ”man
ed”), but man pages are notoriously difficult. They are not written to
teach sed use or regexps to first-time users, but as a reference text
for those already acquainted with these tools.
QUOTING SYNTAX: The preceding examples use single quotes (’…’)
instead of double quotes (”…”) to enclose editing commands, since
sed is typically used on a Unix platform. Single quotes prevent the
Unix shell from intrepreting the dollar sign ($) and backquotes
(`…`), which are expanded by the shell if they are enclosed in
double quotes. Users of the ”csh” shell and derivatives will also need
to quote the exclamation mark (!) with the backslash (i.e., \!) to
properly run the examples listed above, even within single quotes.
Versions of sed written for DOS invariably require double quotes
(”…”) instead of single quotes to enclose editing commands.
USE OF ’\t’ IN SED SCRIPTS: For clarity in documentation, we have used
the expression ’\t’ to indicate a tab character (0×09) in the scripts.
However, most versions of sed do not recognize the ’\t’ abbreviation,
so when typing these scripts from the command line, you should press
the TAB key instead. ’\t’ is supported as a regular expression
metacharacter in awk, perl, and HHsed, sedmod, and GNU sed v3.02.80.
VERSIONS OF SED: Versions of sed do differ, and some slight syntax
variation is to be expected. In particular, most do not support the
use of labels (:name) or branch instructions (b,t) within editing
commands, except at the end of those commands. We have used the syntax
which will be portable to most users of sed, even though the popular
GNU versions of sed allow a more succinct syntax. When the reader sees
a fairly long command such as this:
sed -e ’/AAA/b’ -e ’/BBB/b’ -e ’/CCC/b’ -e d
it is heartening to know that GNU sed will let you reduce it to:
sed ’/AAA/b;/BBB/b;/CCC/b;d’ # or even
sed ’/AAA\|BBB\|CCC/b;d’
In addition, remember that while many versions of sed accept a command
like ”/one/ s/RE1/RE2/”, some do NOT allow ”/one/! s/RE1/RE2/”, which
contains space before the ’s’. Omit the space when typing the command.
OPTIMIZING FOR SPEED: If execution speed needs to be increased (due to
large input files or slow processors or hard disks), substitution will
be executed more quickly if the ”find” expression is specified before
giving the ”s/…/…/” instruction. Thus:
sed ’s/foo/bar/g’ filename # standard replace command
sed ’/foo/ s/foo/bar/g’ filename # executes more quickly
sed ’/foo/ s//bar/g’ filename # shorthand sed syntax
On line selection or deletion in which you only need to output lines
from the first part of the file, a ”quit” command (q) in the script
will drastically reduce processing time for large files. Thus:
sed -n ’45,50p’ filename # print line nos. 45-50 of a file
sed -n ’51q;45,50p’ filename # same, but executes much faster
If you have any additional scripts to contribute or if you find errors
in this document, please send e-mail to the compiler. Indicate the
version of sed you used, the operating system it was compiled for, and
the nature of the problem. Various scripts in this file were written
or contributed by:
Al Aab <af137@freenet.toronto.on.ca> # ”seders” list moderator
Edgar Allen <era@sky.net> # various
Yiorgos Adamopoulos <adamo@softlab.ece.ntua.gr>
Dale Dougherty <dale@songline.com> # author of ”sed & awk”
Carlos Duarte <cdua@algos.inesc.pt> # author of ”do it with sed”
Eric Pement <pemente@northpark.edu> # author of this document
Ken Pizzini <ken@halcyon.com> # author of GNU sed v3.02
S.G. Ravenhall <stew.ravenhall@totalise.co.uk> # great de-html script
Greg Ubben <gsu@romulus.ncsc.mil> # many contributions & much help
For whatever reason, you may need to build the Apache httpd from source. Build apache from source file is among the easiest one if you are talking about LAMP. But that’s not the case if you’re building on a 64bit machine. Most probably you’ll get the following message:
/usr/lib/libexpat.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[3]: *** [libaprutil-1.la] Error 1
make[3]: Leaving directory `/Install/httpd-2.2.8/srclib/apr-util’
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/Install/httpd-2.2.8/srclib/apr-util’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/Install/httpd-2.2.8/srclib’
make: *** [all-recursive] Error 1
The main reason is they don’t like expatriate. No, seriously the main culprit is the /usr/lib/libexpat.so: could not read symbols: File in wrong format. The quick fix is quite simple, just use the internal libexpat by adding –with-expat=builtin when configuring the build.
./configure –prefix=/usr/local/apache2 –enable-module=so –enable-mods-shared=most –with-expat=builtin