Saturday, January 11, 2014

高峰体验

[摘] 一个徒步登山者,费尽千辛万苦,克服许多的艰难险阻,每一步都挣扎在生死边缘。开始的时候,还有很好的现实感,知道山知道水,攀登中还会有幽默和笑语。慢 慢的,躯体的痛苦,情绪的沉抑,心身的耗竭让你忘却了行为的意义,甚至怀疑攀登的价值和现实性,你的内心挤满了渴望与逃避,冒险与胆怯、放弃与坚持的双向 冲突,知觉变得凝重而迟缓,现实感消隐,意识逐步的缩窄。再后来,你的思想似乎停滞,感觉麻木,忘了自己是谁,在做什么和为什么要做,只是机械地向上走。 你的意识界沉静而虚无,只有心灵那一丝光亮,仍在坚持和闪耀着。        终于,你到达了那高耸卓绝的山顶,按理说积压太长的期待会给你带来像爆炸一般的狂喜,但却没有发生。你似乎忘却了自我,忘却了存在,时间和空间消融在一 起,没有边界,四周只有一片纯净的虚空,深邃而神秘。你甚至会有一瞬的迷茫,不知道你接下来要做什么?这时,一种像海潮般的愉悦和满足感从遥远的心灵深处 释放、溢出、扩展,伴随着高峰上的洁净、安详,和谐席卷了你,你似乎听见了心灵的笑声,品尝到生命融入那种永恒与无限的感觉。慢慢的海潮过去,你的内心仍 充满着充沛的活力和美妙无比的欣喜,灵感激荡,思想饱满而充实。在以后很长的日子里,你对自我的态度和对世界的感觉已经完全的不同。每当遇到困难的时候, 回忆那不平凡的一刻,你的内心依然会荡漾出坚毅、活力和创造力,成为你自由、自信、自强不息的精神源泉。

[摘马斯诺高峰体验]

Friday, January 3, 2014

Sed Command Basics


Description: the most command parameter of sed command is 's', which stands for substitute.
Format: sed 'PARAM/REGEXP/REPLACEMENT/FLAG' filename
        It searches for matched patterns (by REGEXP) and replaces it with REPLACEMENT.  PARAM and FLAG decides which match is replaced.

Examples:
  1. Replace every first match in a line 
  $ cat sed_cmd_study.txt
  This is to study sed command in Linux system.
  Actually, this is in a cygwin terminal.
  Here are some list of stuff that I am interested:
  Linux Hacking
  C programming and C++ programming
  Python programming and Perl programming
  Photoshop applications and design
  And all the other related stuffs


  $ sed 's/programming/coding/' sed_cmd_study.txt
  This is to study sed command in Linux system.
  Actually, this is in a cygwin terminal.
  Here are some list of stuff that I am interested:
  Linux Hacking
  C coding and C++ programming

  Python coding and Perl programming
  Photoshop applications and design
  And all the other related stuffs

    [NOTE]: in this case, the original file is not modified


    2.  Replace every matches in file
  $ sed 's/programming/coding/g' sed_cmd_study.txt
  This is to study sed command in Linux system.
  Actually, this is in a cygwin terminal.
  Here are some list of stuff that I am interested:
  Linux Hacking
  C coding and C++ coding
  Python coding and Perl coding
  Photoshop applications and design
  And all the other related stuffs

     
    [NOTE]: in this case, the original file is not modified


     3. Only replace the 2nd occurrence of a line in file
  $ sed 's/programming/coding/2' sed_cmd_study.txt
  This is to study sed command in Linux system.
  Actually, this is in a cygwin terminal.
  Here are some list of stuff that I am interested:
  Linux Hacking
  C programming and C++ coding
  Python programming and Perl coding
  Photoshop applications and design
  And all the other related stuffs

     
    [NOTE]: in this case, the original file is not modified

     4.  Replace all the matches and write the modified lines in a file
  $ sed 's/programming/coding/gw output.txt' sed_cmd_study.txt
  This is to study sed command in Linux system.
  Actually, this is in a cygwin terminal.
  Here are some list of stuff that I am interested:
  Linux Hacking
  C coding and C++ coding
  Python coding and Perl coding
  Photoshop applications and design
  And all the other related stuffs


  $ cat output.txt
  C coding and C++ coding
  Python coding and Perl coding



     5. Delete last X number of characters from each line
  $ sed 's/...$//g' sed_cmd_study.txt
  This is to study sed command in Linux syst
  Actually, this is in a cygwin termin
  Here are some list of stuff that I am interest
  Linux Hack
  C programming and C++ programm
  Python programming and Perl programm
  Photoshop applications and des
  And all the other related stu