Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239354
  • 博文数量: 91
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 955
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-12 09:38
文章分类

全部博文(91)

文章存档

2017年(1)

2011年(1)

2008年(15)

2007年(74)

我的朋友

分类: LINUX

2007-08-23 16:26:22

>:
 这是个重定向命令,也就是将结果写入一个新的文件,如果该文件已存在,里面的内容将会被覆盖。
for example:ls -i *|awk '{print $1}'|sort -nu >in.txt

>> the >> redirection operator can be used to append to existing files.for example.you could use the following command to append a one-line footnode to in.txt:
echo "end of list">>in.txt
  use >> command and the > command's consequence will writed in file,don't display on the terminate.the > and the >> all standard output.
  sandard input can also be redirected.the input redirection operator is <,for example.the following command will send a mail message with the contents of the file in.txt to user jedan:
  mail -s "idone list" jdean<in.txt
  send stdout to file. $cmd >file or cmd 1>file
  send stderr to file. $cmd 2>file
  send both stdout and stderr to file $cmd >file 2>&1
  send stdout to file1 and stderr to file2 $cmd >file 2<file2
  receive stdin from file $cmd <file
  append stdout to file $cmd >>file or $cmd 1 >>file
  append stderr to file $cmd 2 >>file
  append both stdout and stderr to file $cmd >>file 2>&1
  pipe stdout from cmd1 to cmd2 $cmd1|cmd2
  pipe stdout and stdin from cmd1 to cmd2 $cmd1 2>&1|cmd2

tee
  tee [options] files
  read from standard input and write both to one or more files and to standard output(analogous(类似的,相似的)to a tee junction(交叉点,汇合处) in a pipe)
  -a append to files rather than overwriting them
  example:suppose you're running a pipeline of commands cmd1,cmd2 and cmd3
  $cmd1|cmd2|cmd3>file1
this sequence puts the ultimate output of the pipeline into file1.however,you may also be interested in the intemediate result of cmd1.to create a new file_cmd1 containing those result.use tee:
 $cmd1|tee file_cmd1|cmd2|cmd3>file1

阅读(784) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~