![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| to get a line above the search word | sachin.gangadha | UNIX for Dummies Questions & Answers | 16 | 01-07-2008 04:19 AM |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 07:24 AM |
| search whole line using grep | useless79 | Shell Programming and Scripting | 1 | 11-23-2007 02:14 AM |
| search and replace the whole line | Jartan | Shell Programming and Scripting | 17 | 09-25-2007 10:58 AM |
| search a long line | mpang_ | Shell Programming and Scripting | 14 | 03-21-2007 04:56 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I am supposed to collect a huge amount of log files from a unix system (HP-UX) onto a local system. The log files are not in one place, but they are scattered all over the Unix server. The unix server has only limited space, so that I can not create a tar file first and then compress it. I am trying to do something like tar -cvf | gzip -c but it fails due to spaces in the file name. The command I am trying is: find /BaseDirectory -name "*.log" | xargs tar -cvf | gzip -c > AllLogFiles.tgz I am getting errors like: tar: cannot stat ./BACKUP/24-11-2007. Not dumped. tar: cannot stat 02.52.45-BACKUP.log. Not dumped. tar: cannot stat ./BACKUP/24-11-2007. Not dumped. tar: cannot stat 02.56.40-BACKUP.log. Not dumped. tar: cannot stat ./BACKUP/24-11-2007. Not dumped. Is it because of spaces or hyphens in the file name? Or am I trying a wrong command? (Original filenames are like "24-11-2007 02.53.32-BACKU.log") Alternatively, Is there any way that I can collect all *.log files into one compressed file (so that the command doesn't error out due to lack of space while collecting log files)? The actual archive type is not important, it could be gzip, compress, pack or anything. Thanks for reading my query, and have a nice day/evening. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Hi,
How about search, cpio and compress ? since tar is just an archiver as well as cpio which does no compression at all ? Code:
find . -name "*.log" -print | cpio -o | gzip -c > AllLogFiles.cpio.gz # to compress gzip -dc AllLogFiles.cpio.gz | cpio -i # to decompress |
|
#3
|
|||
|
|||
|
Thanks andryk, that was real quick.
I executed that on a small folder, and the first command worked properly. However, the second one is giving error: missing 'd' option Cannot create directory for <mainlog> (errno:2) missing 'd' option Cannot create directory for <BACKUP> (errno:2) missing 'd' option Cannot create directory for <BACKUP> (errno:2) missing 'd' option Cannot create directory for <BACKUP> (errno:2) .... .... Any ideas? |
|
#4
|
|||
|
|||
|
I added -d to cpio and the problem is solved.
Thanks andryk, you have saved me a lot of trouble, and it was quick. |
|
#5
|
||||
|
||||
|
Well, glad i could help ... and sorry i forgot that 'd', first time using cpio
|
||||
| Google The UNIX and Linux Forums |