I want to remove all the white spaces from a given text files (about 200,000 of them).
I know how to remove whitespace for one of them:
cat file.txt | tr -d " \t\n\r" 
How I can do that for all folder?
One way is by iterating on the files in the current directory:
for file in *; do
   cat $file | tr -d " \t\n\r" 
done
Or, maybe better:
for file in *; do
   sed -i 's/ //g' $file
done 
 
    
    I would use find for this:
find . -type f -exec sed -i ':a;N;s/[[:space:]]*//g;ba' {}  \;
This assumes the files are of reasonable sizes :-/
 
    
    Just use a for loop
i.e.
for i in *
do
   cat $i | tr -d " \t\n\r" > $i.tmp
   rm -f $i
   mv $i.tmp $i
done;
