space in filename difficulty
I have a bunch of files that accidentally got written with a space in them:
301_A_L_mask _face.img 301_A_L_mask _scene.img 301_A_R_mask _face.img 301_A_R_mask _scene.img 302... 303... etc. How can I batch re-write these files to erase the space? For example, 301_A_L_mask _face.img -> 301_A_L_mask_face.img Any help would be greatly appreciated! Thanks, David |
Code:
for file in `ls *.img` Edit: as per ghostdog74's comment: new_file=`echo $file |sed -e 's/ //'` only use '$' when reading a bash var, not when writing to one (yeah, Perl is different) |
Code:
for file in *.IMG |
Quote:
|
I feel very inellegant folks, a bit filename specific perhaps:
Code:
#!/bin/bash Whatever you do be safe. |
All times are GMT -5. The time now is 05:19 AM. |