2

I want to remove all non-ASCII characters from all .tex files in a directory. I know I can use the code:

LC_ALL=C tr -dc '\0-\177' <file >newfile

for each single file, but I have 200 .tex files. How I can apply this command to all .tex files in the directory and replace each file with a new clean one with the same name?

0

2 Answers 2

4

Just use sed with in-place replace:

LC_ALL=C sed -i 's/[^\x0-\xB1]//g' multiplefiles*.tex

link to ASCII-table

  • \d0-\d177: Decimal
  • \x0-\xB1: Hex
  • \o0-\o261: Octal
0
4

This might do what you want:

strings [infile] > [outfile] 
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .