Re: remove words from mutiple files
- From: Chill Out <chilli@xxxxxxxxxxx>
- Date: Tue, 30 Dec 2008 19:20:08 GMT
On Tue, 30 Dec 2008 05:41:17 -0800, Jesse Dorland wrote for every to
trash:
On Dec 30, 12:36 am, Mysterious Traveler <mysterious_trave...@xxxxxxx>
wrote:
Jesse Dorland wrote:
I have downloaded some 100 astronomical files. All of the files have
words "Mr. Big". Is there a way to remove these words?
If your word processor has a find and replace option, you can have it
find "Mr. Big" and in the replace field try using a space for the word.
In Windows I was able to do this by holding down the alt key and
pressing 255 on the keypad, this makes an invisible character that
takes the place of the words you want to get rid of, but in Linux those
characters can't be made. Maybe someone else can suggest a way, or you
could edit those text files running Windows.
Mysterious Traveler
Well, my situation is bit more complicated. You see, in this folder I
have some 100 .doc files, and about 200 .jpg files. Inside all the doc
files, I have a word "Mr. Big", and then all the files names
(Saturn_Mr.Big.doc), (Venus_Mr.Big.doc), and same goes for .jpgs files.
So I want to remove not only from documents, but from files names too.
That would be a good use for the rename feature if its in Ubuntu.
If not use Aho's example to rename the file during the mv step.
or here's an old example
#!/bin/sh
# renames files
if [ $# -eq 0 ] # if there is input
then
echo $1 "requires dir filenam/n";
exit
fi
for filename in $1 # Not necessary to use basename,
# since "*" won't return any file containing "/".
do n=`echo "$filename" | tr '[A-Z]' '{a-z}'`
# Variable substitution:
n=${n%/} # Removes trailing slash, added above, from filename.
[[ $filename == $n ]] || cp "$filename" "$n"
# Checks if filename already lowercase.
[[ $filename == $n ]] || echo "$filename" " moved to " "$n" >> /tmp/
fmtfile.ans
# Prints changed filenames
done
.
- References:
- remove words from mutiple files
- From: Jesse Dorland
- Re: remove words from mutiple files
- From: Mysterious Traveler
- Re: remove words from mutiple files
- From: Jesse Dorland
- remove words from mutiple files
- Prev by Date: Re: remove words from mutiple files
- Next by Date: Re: (Ubuntu Linux 8.10) [07/23] - "ubuntu-8.10-desktop-i386.iso.007" yE
- Previous by thread: Re: remove words from mutiple files
- Next by thread: Re: remove words from mutiple files
- Index(es):
Relevant Pages
|