Jump to content

Featured Replies

Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...