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?
|