LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 717|回复: 8

诸位仁兄,有请了![基本解决]

[复制链接]
发表于 2004-3-25 21:06:44 | 显示全部楼层 |阅读模式
问题一:
unix或是linux下ftp的密码文件位置在哪儿?

问题二:
一个文件内容如下:
abcdsgsgfsgs
cdefdsgdgsd
fghgdgdggg
ddddddddddd

如何做到,不用文本编辑器vi等,而用unix命令的方式把第二行兰色的部份替换成以下红色部份:
1234567890

谢谢了。

:help :thank
发表于 2004-3-25 22:06:53 | 显示全部楼层
1,不知道!
2,用sed是否可以? ;)
发表于 2004-3-25 22:31:55 | 显示全部楼层
1.ftp用户可分为local的真实用户和虚拟用户(即只能ftp不能有shell),他们的username/passwd都存放在/etc/passwd下。ftp调用的是系统的密码。
2.sed 的s命令就应可以。
 楼主| 发表于 2004-3-26 00:10:01 | 显示全部楼层
谢谢两位仁兄。
sed用法不太明白。有个例子说明就好了。
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

  -n, --quiet, --silent
                 suppress automatic printing of pattern space
  -e script, --expression=script
                 add the script to the commands to be executed
  -f script-file, --file=script-file
                 add the contents of script-file to the commands to be executed
      --help     display this help and exit
  -V, --version  output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret.  All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

E-mail bug reports to: bug-gnu-utils@gnu.org .
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
发表于 2004-3-26 00:23:11 | 显示全部楼层
比如:
  1. /home/javalee:echo abc|sed 's/a/A/'
  2. Abc
复制代码
这里是一些实例,请参考参考!~~~
http://www.linuxsir.cn/bbs/showthread.php?threadid=21398
http://www.linuxsir.cn/bbs/showthread.php?threadid=23617
 楼主| 发表于 2004-3-29 23:12:30 | 显示全部楼层
谢谢j兄。awk和sed 好复杂...
发表于 2004-3-29 23:14:04 | 显示全部楼层
最初由 hzqe 发表
谢谢j兄。awk和sed 好复杂...

兄弟买本O'reilly系列的《sed&awk》看看,包你两三天学会,呵呵。
电子书看得挺累的。
发表于 2004-3-29 23:29:04 | 显示全部楼层
最初由 home_king 发表
兄弟买本O'reilly系列的《sed&awk》看看,包你两三天学会,呵呵。
电子书看得挺累的。

同感~~~.
ps:谢谢教主为兄弟们答疑解惑 :thank
发表于 2004-3-29 23:34:24 | 显示全部楼层
呵呵,javalee老兄又在开玩笑了。
最近正在看Andrew S. Tanenbaum(Linus的老对手啦)的《Modern Operating Systems》英文原版,看到很多专业的词汇,头有点晕了。于是来linuxsir逛逛。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表