tar --exclude and grep -v

  • Thread starter Thread starter chris_inx
  • Start date Start date
C

chris_inx

Hi.

In a directory, I have files named a, b, c, d, e, f, g, h, i, and j.
When I want ls to output only the file named e, I use
Code:
ls | grep -e 'e'
Now, if I want ls to output everything except e, I use
Code:
ls | grep -e 'e' -v
Now, I want to create a .tar.gz file that contains only e, I use
Code:
tar --exclude=´ls | grep -e 'e' -v´ -c -z -f ./file.tar.gz ./
But all files except e were tarred. Can someone please explain me what is wrong with that ?
(Of course, this is a basic example, and the easiest/laziest answers would be : tar -c -z -f ./file.tar.gz ./e OR tar --exclude=´ls | grep -e 'e'´ -c -z -f ./file.tar.gz ./e).

Thanks in advance

Continue reading...
 
Back
Top