由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - 文件改名一问?
相关主题
Re: how to change all the files .cpp to .Cequivilent $REMOTEHOST in ksh
关于emacs一问。shell programming问题:如何同时run多个作业
how to run background process after logoutChange shell to tcsh?
关于cxterm的问题.cshrc?.login?.profile?
[转载] About the historybash 彩色 shell prompt
如何单步执行shell?如何在当前目录下查找替换一个串?
which shell is best?生成script文件的问题
how to let awk not print?how to redirect error output under unix
相关话题的讨论汇总
话题: sige话题: file话题: echo话题: mv话题: should
进入Unix版参与讨论
1 (共1页)
R**g
发帖数: 59
1
怎么把列在 ‘ls sige*' 的所有文件改为 sige.* ?
thank you very much.
X****r
发帖数: 3557
2
I usually use this, but I bet there's a better way doing so
(assuming tcsh)
foreach file ( sige* )
mv $file `echo $file | cut -c -4`.`echo $file | cut -c 5-`
end

【在 R**g 的大作中提到】
: 怎么把列在 ‘ls sige*' 的所有文件改为 sige.* ?
: thank you very much.

c*****t
发帖数: 1879
3

^^^^^^^^^^^^^^^^^^^^^^^
hehe, not going to work. Should be
mv $file `echo $file | sed 's/^sige/sige\./g'`

【在 X****r 的大作中提到】
: I usually use this, but I bet there's a better way doing so
: (assuming tcsh)
: foreach file ( sige* )
: mv $file `echo $file | cut -c -4`.`echo $file | cut -c 5-`
: end

X****r
发帖数: 3557
4
You sure? at least it worked on my machine... or I had a typo?

【在 c*****t 的大作中提到】
:
: ^^^^^^^^^^^^^^^^^^^^^^^
: hehe, not going to work. Should be
: mv $file `echo $file | sed 's/^sige/sige\./g'`

c*****t
发帖数: 1879
5
oops, my mistake :)

【在 X****r 的大作中提到】
: You sure? at least it worked on my machine... or I had a typo?
1 (共1页)
进入Unix版参与讨论
相关主题
how to redirect error output under unix[转载] About the history
[转载] 再请教高手如何单步执行shell?
[转载] 请教高手which shell is best?
how to escape both ' and " from tcsh?how to let awk not print?
Re: how to change all the files .cpp to .Cequivilent $REMOTEHOST in ksh
关于emacs一问。shell programming问题:如何同时run多个作业
how to run background process after logoutChange shell to tcsh?
关于cxterm的问题.cshrc?.login?.profile?
相关话题的讨论汇总
话题: sige话题: file话题: echo话题: mv话题: should