- I use terminal in Os X 10.9;
- I want to delete the same lines in multiple files in the same directory;
- The file in the directory are named 1.txt 2.txt 3.txt etc. (170 files);
- The purpose is to delete all the lines except 156 to 698 in every file;
- The command look like this:
find . -type f -name "*.txt" | xargs sed -i '156,698!d'
Doesn't work except for the first file ? What is the best way to do this ?
Thanks
You can use the
-I
option withxargs
and do something like this: