Monday, September 6, 2010

grep

1. ls -la egrep '^[^d]' > allfiles

2. cat a-j_malenames.txt k-z_malenames.txt > a-z_malenames.text

3. wc -w /usr/local/linuxgym-data/gutenberg/0ws0310.txt > count.output

4. cat /usr/local/linuxgym-data/gutenberg/0ws0310.txt wc –m > pipecount

5. ls /usr/local/linuxgym-data/Gutenberg egrep 'rd' > rdfiles.txt


6. Mkdir s2-files
cd /usr/local/linuxgym-data/gutenberg
cp *s2* s2-files

7. Ls -l sort-r awk '{print $8}' > large_to_small

8. pico wcscript.sh
#!/bin/bash
wc -w $1 awk '{print $1}'
chmod u+x wcscript.sh
./wcscript.sh a.txt

9. egrep -w 'Anne' /usr/local/linuxgym-data/gutenberg/12frd10.txt > anne-words.txt

10. egrep -v '' femalenames.txt egrep '^MAT^NAT' femalenames.txt > natmat.txt

grep

编辑本段1. grep简介  egrep和fgrep的命令只跟grep有很小不同。egrep是grep的扩展,支持更多的re元字符, fgrep就是fixed grep或fast grep,它们把所有的字母都看作单词,也就是说,正则表达式中的元字符表示回其自身的字面意义,不再特殊。linux使用GNU版本的grep。它功能更强,可以通过-G、-E、-F命令行选项来使用egrep和fgrep的功能。
  grep的工作方式是这样的,它在一个或多个文件中搜索字符串模板。如果模板包括空格,则必须被引用,模板后的所有字符串被看作文件名。搜索的结果被送到屏幕,不影响原文件内容。
  grep可用于shell脚本,因为grep通过返回一个状态值来说明搜索的状态,如果模板搜索成功,则返回0,如果搜索不成功,则返回1,如果搜索的文件不存在,则返回2。我们利用这些返回值就可进行一些自动化的文本处理工作。
编辑本段2. grep正则表达式元字符集(基本集)  ^
  锚定行的开始 如:'^grep'匹配所有以grep开头的行。
  $
  锚定行的结束 如:'grep$'匹配所有以grep结尾的行。
  .
  匹配一个非换行符的字符 如:'gr.p'匹配gr后接一个任意字符,然后是p。
  *
  匹配零个或多个先前字符 如:'*grep'匹配所有一个或多个空格后紧跟grep的行。 .*一起用代表任意字符。
  []
  匹配一个指定范围内的字符,如'[Gg]rep'匹配Grep和grep。
  [^]
  匹配一个不在指定范围内的字符,如:'[^A-FH-Z]rep'匹配不包含A-F和H-Z的一个字母开头,紧跟rep的行。
  \(..\)
  标记匹配字符,如'\(love\)',love被标记为1。
  \<
  锚定单词的开始,如:'\  \>
  锚定单词的结束,如'grep\>'匹配包含以grep结尾的单词的行。
  x\{m\}
  重复字符x,m次,如:'o\{5\}'匹配包含5个o的行。
  x\{m,\}
  重复字符x,至少m次,如:'o\{5,\}'匹配至少有5个o的行。
  x\{m,n\}
  重复字符x,至少m次,不多于n次,如:'o\{5,10\}'匹配5--10个o的行。
  \w
  匹配文字和数字字符,也就是[A-Za-z0-9],如:'G\w*p'匹配以G后跟零个或多个文字或数字字符,然后是p。
  \W
  \w的反置形式,匹配一个或多个非单词字符,如点号句号等。
  \b
  单词锁定符,如: '\bgrep\b'只匹配grep。
编辑本段3. 用于egrep和 grep -E的元字符扩展集  +
  匹配一个或多个先前的字符。如:'[a-z]+able',匹配一个或多个小写字母后跟able的串,如loveable,enable,disable等。
  ?
  匹配零个或多个先前的字符。如:'gr?p'匹配gr后跟一个或没有字符,然后是p的行。
  abc
  匹配a或b或c。如:grepsed匹配grep或sed
  ()
  分组符号,如:love(ablers)ov+匹配loveable或lovers,匹配一个或多个ov。
  x,x{m,},x{m,n}
  作用同x\{m\},x\{m,\},x\{m,n\}
编辑本段4. POSIX字符类  为了在不同国家的字符编码中保持一至,POSIX(The Portable Operating System Interface)增加了特殊的字符类,如[:alnum:]是A-Za-z0-9的另一个写法。要把它们放到[]号内才能成为正则表达式,如[A- Za-z0-9]或[[:alnum:]]。在linux下的grep除fgrep外,都支持POSIX的字符类。
  [:alnum:]
  文字数字字符
  [:alpha:]
  文字字符
  [:digit:]
  数字字符
  [:graph:]
  非空字符(非空格、控制字符)
  [:lower:]
  小写字符
  [:cntrl:]
  控制字符
  [:print:]
  非空字符(包括空格)
  [:punct:]
  标点符号
  [:space:]
  所有空白字符(新行,空格,制表符)
  [:upper:]
  大写字符
  [:xdigit:]
  十六进制数字(0-9,a-f,A-F)
编辑本段5. Grep命令选项  -?
  同时显示匹配行上下的?行,如:grep -2 pattern filename同时显示匹配行的上下2行。
  -b,--byte-offset
  打印匹配行前面打印该行所在的块号码。
  -c,--count
  只打印匹配的行数,不显示匹配的内容。
  -f File,--file=File
  从文件中提取模板。空文件中包含0个模板,所以什么都不匹配。
  -h,--no-filename
  当搜索多个文件时,不显示匹配文件名前缀。
  -i,--ignore-case
  忽略大小写差别。
  -q,--quiet
  取消显示,只返回退出状态。0则表示找到了匹配的行。
  -l,--files-with-matches
  打印匹配模板的文件清单。
  -L,--files-without-match
  打印不匹配模板的文件清单。
  -n,--line-number
  在匹配的行前面打印行号。
  -s,--silent
  不显示关于不存在或者无法读取文件的错误信息。
  -v,--revert-match
  反检索,只显示不匹配的行。
  -w,--word-regexp
  如果被\<和\>引用,就把表达式做为一个单词搜索。
  -V,--version
  显示软件版本信息。
编辑本段6. 实例  要用好grep这个工具,其实就是要写好正则表达式,所以这里不对grep的所有功能进行实例讲解,只列几个例子,讲解一个正则表达式的写法。
  $ ls -l grep '^a'
  通过管道过滤ls -l输出的内容,只显示以a开头的行。
  $ grep 'test' d*
  显示所有以d开头的文件中包含test的行。
  $ grep 'test' aa bb cc
  显示在aa,bb,cc文件中匹配test的行。
  $ grep '[a-z]\{5\}' aa
  显示所有包含每个字符串至少有5个连续小写字符的字符串的行。
  $ grep 'w\(es\)t.*\1' aa
  如果west被匹配,则es就被存储到内存中,并标记为1,然后搜索任意个字符(.*),这些字符后面紧跟着另外一个es(\1),找到就显示该行。如果用egrep或grep -E,就不用"\"号进行转义,直接写成'w(es)t.*\1'就可以了。

Thursday, May 28, 2009

week 12 Exhibition

This week, I think we did really good job in the exhibition. Everything works as we expected. although there is some bugs in the playing game animation and high demand for fixation of the projects position, i show lecturer,tutors and visitors a perfect job. The most exciting thing is that our project will be exhibited on the open day. lol,lol.....so happy to see the result that we fight for. i will graduate this semester so that i could not attend the open day this August. but i am so appreciate our project receive recognition from lecturer,tutors and visitors.

At the end, i want to say thank you. thanks Stephen, thanks Marie, thanks Dekker. i know only "thank you "is not enough to describe how i appreciate. But really, thank your guys very much~ Without you guys, our project is nothing!!! Thanks for teaching us a lot!!!

week 11 the last vision of physical & sound effect

Physical book:
This week Stephen gave us suggestion that don’t tie all the pages together by burrow the edge of the book. It will be influent a good looking of the book. Even he tries to help us to modify without redo the physical book. After we discussed, redo the book is the best way to show the high quality to the audience. So redo the physic book is our main works in this week.

Animation part:
Last week, all animations finished the final vision. So this week, I start to import the sound effects into our flash animations. Because we didn’t play any musical instrument, I do some research about the copyright free background music. Then, I use the recorder and Cool edit to record and edit the animal voice. I try to make the voice without the surrounding noise.

week10 Book of original vision & final animation adjust

From this week, we are work together with our individual wroks.

This week we finished the first vision of each page of the book. We want to get feedback from lecturers and tutors. So we have not tied together all pages of the book.



































































Animation part:I have finished all the animation last week. But this week I had to adjust all animations in the right size (800pix X 600pix), high solution.

week9 the last two animations

This week, i finished the last two animations. the first page animation was playing with high solution. But the quiz flash, but the coding part has some problem that i need get help from Dekker. I were get used to write coding in AS2.0, and get lost completely in the As 3.0 language this time. But thanks Dekker taught me a lot so that i could understand how is that work in AS3.0. I think i know what i need to learn next. Yes, it is AS3.0. AS3.0 will be needed in my future work. Here also post ink of those two original vision of animations:
First page animation:http://up.qzone.net.cn/flash6/20090612060035_anmation1.swf
Link for quiz:http://up.qzone.net.cn/flash6/20090612050358_quizas3.swf

week 8 opening aniamtion

This week, the opening animation is beginning to shape up. The scene setting and animation took me a lot time to be perfect in visualy sensation.
opening animation:http://up.qzone.net.cn/flash6/20090612055026_ienv3000--CS4.swf

Week 7 create characters and scene

From this week, our team was breakin down. each of us do the individual task. My responsible for the 3 pages animation.

Following the result of interview, we realize that animal characters will be the favorite character for 4-6 children. Due to this book is preschool educational book, we are considering the theme would better be close to student life. So for the opening animation, we are try to represent some animal students are going to school in the forest.
there are some characters that i have create this week.






Monday, April 13, 2009

Week 6 Interview&Research

This week Lin and me are responsible for doing the interview. According to our teammates and tutors and lecturer discussed, we decided to design a book for 4-6 age children, named interactive story book. Stephen and marine suggest our do a few interview, knowing how to design the book suit for their children. This is our interview questions.

Questions:
1.Do your children enjoy reading books?If they like reading, where do they like to read?What type of books do they like?
2.Have your children read any interactive books?If yes, can you describe what interactive activities they had?Did your child enjoy reading interactive books?
3.To what extent do you think it is good for children to learn reading with an interactive book?4.When do you think it would be good to use the interactive story book?
5.Where do you think it is good for children use the interactive story book?
6.Would you like to spend more time on accompanying your child to read the interactive story book each day?
7.What is your child’s favorite cartoon character?
8.What impact would the interactive story book have on your daily relationship between your children and you?
9.(show design suggestions of the interactive story book to the interviewed person)

In this week, we still need to do some research about some interactive books that already exist. We can obtain some ideas from those resources.


To attract children attention, we decide to create a pop-up book. This is good example of Pop-up book.


This is cool thing that people wave hand to turn over the page. this video give us idea for the quiz part, we can allow children wave hand to throw rubbish into the bin.


i love this video. at the begining, we have some thoughts about the book project on the floor. that like this. but we killed this idea, just this idea emerge from our mind. it is not enough physical work to achieve. But i still love this idea.

Sunday, March 29, 2009

Week 5 presentation

In this week, we are preparing for two ideas about project plan in our presentation. We offer the prototype of sketch and flash animation vision for these two ideas, which makes people fully understanding what we try to represent. Because we obtained more team project experience last semester in studio III, we have written done draft of the presentation, we are repeating them from our memories when we are representing. Despite sometimes we are too nervous to very fluent speech, but I believe we did our best to represent.

The two ideas of presentation I represent in last week journal. The E-business card and the interactive story book. This week we extend more thoughts in those two ideas. Such as how is that working? which technology we going to use?



We show two ideas in our presentation because we like both of them. it is difficult to make a decision to pick up one of them. So hopefully we can get feedback from lecturer, tutors and classmates. Finally, the interactive story book is the one that almost people like better. And lecturer and tutors help us to think more ideas to consummate the shortage of our project

Week 4 Brainstoming

From this week, we start to work on the project in the group. The first thing, we had to decide what we going to do. So, in this week, we are beat our brain to brainstorming. We have three ideas about this project.
The first one is bus device, which helps blinding people catch the bus without someone’s help. When the bus close to the bus stop, the RFID is able to sense and control the voice device to announce the number of the bus. Thus, blinding people could catch the correct bus without helps.
The second idea is about the E-business card. Imaging how pollutions you had made if you use paper write down the personal detail and pass to the new friends. Imaging if you are business man, how many people you have met and how many paper you have to use. So in the Sustainability way, we have idea about we use E-business to transfer the ID between friends or businesses. It is easy and environmental way to exchange the ID.
The third idea is the Holographic story book. This book is basic on children preschool education. The physic book is pop-up book, but the most interesting thing is children can see the vividly animation in the book. When they turn over the page, the animation will be change.

Saturday, March 14, 2009

Week 3---Review:Physical computing---- DeLighTable

Introduction:

At the first glance, the DelighTable is just like a normal table setting in the store. When you touch it and feel it, you will discover that is high tech table. When you own it, you will light your life up. The DelighTable has a fantastic affect with drink, especially drink with the ice. It glows directly under the glass and shines up through the drink. If it has ice in it, the cube will reflect the light to the supernatural looking. The cool thing fo DelighTable is the prototype, wherever it is touched and remembers for a few seconds after you could write or draw right on that table.



















Technology:
The entirely surface is just 25 mm thick and it is water-proof, which is a touch-sensitive plane which glows in different color. The table inner working consists of an opaque liquid which is like sandwiches between a layer of transparent plastic film and a light source. When touched, the liquid disperses, allowing the light to shine through.

Project dissemination:
In recent year, the technology of DelighTable is popular by manufactories. They used this technology in many formats: coffee table, writing/drawing desk, Dinning table, ibar, shelf panel to light up the glasses etc. Especially it is most popular in the ibar and coffee table. Some theme clubs use this technology to provide fashion and mysterious feeling in order to attract more customers.

Relevant:

It is not going to say that DelighTable with high technology more expensive than normal table, so users are not willing to throw away after they just used for a short period. The surface adhibits a transparent plastic film which can protect the surface was scored. Users are able to change a new transparent plastic film to make the DelighTable looks like a new one.
The high technological DelighTable is just consumes only 12 volts of energy. This product as save energy as possible. Sometimes, the DelighTable can instead of the paper, for example, order bill, draft paper etc. In this way, it can reduce pollution and protect the environment.

Reflection:

After researching of the review of the DelighTable, I realize that physical computing product can enrich our daily lives in many ways. A great design product will improve the quality of the human daily lives. A successful design had to consider not only cost, convenience and benefit, but also energy, environment and pollution. So in my opinion, the DelighTable is a successful example of physical computing influence on our daily life.

Reference:
Rollins, M, 2007, “Kloss DelighTable” available at: http://www.gadgets-weblog.com/50226711/kloss_delightable.php, view at 11st March 2009
Siach,T,2007,"Kloss DeLighTable Touch-Sensitive Coffee Table",available at:http://www.walyou.com/blog/2007/11/08/kloss-delightable-touch-sensitive-coffee-table/, view at 13rd March, 2009
Thenewmonk,2006, "DelighTable", available at: http://www.youtube.com/watch?v=QGEEwLetRPY, view at 13rd March,2009

Monday, March 9, 2009

week 2

Key words: Sustainable Design,

This week, lecturer give us some good example of physical computing. especially, the memory chocolate video show the way to attract people to love the product. A sucessful design product is basic on the great function, pretty interface, usefulness,worth, and sustainability.

1.why is sustainability important?
2. Who does it affect?
3. How can we design thing to be more sustainable?
4.What could be design to improve sustainability?

Monday, March 2, 2009

WEEK 1

Key words: Physical computing, Sustainability

In this week lecture, it could make up of two parts, which are physical computing and sustainability. Lecturer told us the Physical Computing is about people interacts through computer via physical interaction. It makes the keyboard, mouse and display behind. For example, touch screen is kind of the physical computing.

I borrowed Physical Computing from library which is lecture recommended. In that book, I found a concept of physical computing. “Physical computing is about creating a conversation between the physical world and the virtual world of the computer” (Sullivan,D & Lgoe, T, pp. xix)
I have done some research about physical computing from internet. A good and clear concept is that “Physical computing is using our own physical inputs and using microcontollers or computers to control outputs.”(
http://www.instructables.com/id/SPEI8XLF3ER7V2F/)

So in my word, physical computing is about the communications between physical energy and electrical energy. For easier understand, a vivid chat from Physical Computing is clearly describe how does physical computing work.

Another important word has been talked about is Sustainability in Design. What is sustainability? The guest lecture, Will Odom give some example is about the sustainable design. For example, the energy plugs, energy tree etc. he also show the issue about the old technical devices such as mobile, camera are discard anywhere, which is a serous pollution for the environment.