由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - 怎么样循环执行一个命令?
相关主题
[转载] compareHelp please: 2GB limit on file size
怎么把一个文件的每一行合并到另外一个文件的对应行?请问unix/Linux中设置共享目录
请教怎样使用tar压文件diff -y: how to suppress the same lines?
Help! How to replace string in a variable?question about appending file
怎样将一个大文件分成两个文件?shell script for column operation
compare which file is newer请教一个文件处理的问题
Remove core.xxxx files?A simple question!
a question about shell quote请诊断:
相关话题的讨论汇总
话题: dir2话题: dir1话题: user话题: dir3话题: ls
进入Unix版参与讨论
1 (共1页)
t*******l
发帖数: 421
1
比如在每个目录里有个子目录,其中包括一个文件含有我需要的信息。
$ ls
dir1 dir2 dir3
$ ls dir1
file1
$ more file1
user name: mary england
$ ls dir2
file2
$ more file2
user name: jon hotland
... ...
如果我想写个script,运行后会从第一到第三个目录自动找到user name,
用foreach file (*)语句后,却只读了第一个dir1,没有接着做dir2,dir3.
请帮我提示一下。多谢。
D**e
发帖数: 10169
2
find ./ -print | xargs grep user "{}"

【在 t*******l 的大作中提到】
: 比如在每个目录里有个子目录,其中包括一个文件含有我需要的信息。
: $ ls
: dir1 dir2 dir3
: $ ls dir1
: file1
: $ more file1
: user name: mary england
: $ ls dir2
: file2
: $ more file2

1 (共1页)
进入Unix版参与讨论
相关主题
请诊断:怎样将一个大文件分成两个文件?
请教一个问题compare which file is newer
help: how to copy files simultaneously to several foldersRemove core.xxxx files?
Re: help: how to copy files simultaneously to several foldersa question about shell quote
[转载] compareHelp please: 2GB limit on file size
怎么把一个文件的每一行合并到另外一个文件的对应行?请问unix/Linux中设置共享目录
请教怎样使用tar压文件diff -y: how to suppress the same lines?
Help! How to replace string in a variable?question about appending file
相关话题的讨论汇总
话题: dir2话题: dir1话题: user话题: dir3话题: ls