> On Tue, 24 Feb 2004 17:56:49 +0100 (CET)
> [EMAIL PROTECTED] wrote:
>
>> Hello guys! I have two questions about shellscripts:
>
> Your second question seems to have been addressed, so here's something
> for your first question...
>
>> 1) I have a backup job that 'tar's a lot of files and currently I
>> redirect all output of the job to a log. Tar unfortunately lists all
>> directories that it goes through, even if nothing is 'tar'ed in those
>> directories. So my logfile contains all my directories. I want to
>> filter out all lines in my tar-log that ends with slash ("/") since
>> those are directories. I want to sort of do an inverse grep on the
>> last character when tarring. Like: tar -cvf myback.tar |grep -v "all
>> lines that end with slash" > log.txt. All files that are backed up
>> contain the whole directory path (that's how I want it) - so I can't
>> simply do a reverse grep for the slash-char. Maybe you could do
>> something with awk? I'm a total rookie with awk, so I'm lost there...
>
> Try
>
>       tar -cvf myback.tar | grep -v '/$'
>
> The $ in the grep pattern indicates "end of line".
>
> -Chris

Yes! That's exactly what I wanted! Thanks a lot!

Cheers,
Mathias

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to