Sponsored Content
Full Discussion: Problem to read archive
Top Forums Shell Programming and Scripting Problem to read archive Post 302368140 by Scrutinizer on Wednesday 4th of November 2009 07:28:54 AM
Old 11-04-2009
@cewa67: Try using IFS= read -r instead of read
Code:
while IFS= read -r registro

Code:
grep . *_*
00_file.txt:00 02112009
02_file.txt:archive test 02 sequence 03 02length 52
02_file.txt:archive test 02 sequence 04 02length 52
02_file.txt:archive test 02 sequence 05 02length 52
06_file.txt:teste arquivo 06 sequencia 08 06 length 54
06_file.txt:teste arquivo 06 sequencia 09 06 length 54
08_file.txt:teste arquivo 08 sequencia 01 08 length 88
09_file.txt:teste arquivo 09 sequencia 01 09 length 79
99_file.txt:99 00000061

If I put double quotes around $registro when writing to the output files, to preserve original spacing I get:
Code:
00_file.txt:                                     00                                   02112009
02_file.txt:archive test  02  sequence 03        02length     52
02_file.txt:archive test  02  sequence 04        02length     52
02_file.txt:archive test  02  sequence 05        02length     52
06_file.txt:teste arquivo 06 sequencia 08        06  length     54
06_file.txt:teste arquivo 06 sequencia 09        06  length     54
08_file.txt:teste arquivo 08 sequencia 01        08                                    length     88
09_file.txt:teste arquivo 09 sequencia 01        09                           length     79
99_file.txt:                                     99     00000061


Last edited by Scrutinizer; 11-04-2009 at 09:14 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read from file then purge or archive.

Hi All, I have a root directory /tmp and I want to purge files or archive files in its subsequent subfolders.I listed the path of files I want to purge(archive) and the #of days. (purge) DAYS PATH 7 /tmp/arsenal/* 5 /tmp/chelsea/* (archive? the same as above but different folders... (15 Replies)
Discussion started by: kayarsenal
15 Replies

2. Shell Programming and Scripting

read list of filenames from text file, archive, and remove

I posted a week ago regarding this scripting question, but I need to revisit and have a few more questions answered.. User cfajohnson was extremely helpful with the archive script, but clarification on my part is needed to help steer the answer in a direction that works in this particular... (5 Replies)
Discussion started by: fxvisions
5 Replies

3. Solaris

problem in creating flash archive

Dear all I am in a problem. I have created a master server on which I have install a Solaris 10 OS as well as Oracle 10g with some additional solaris packages. Now I want to create a flash archive of this server and install that flash archive on another server, so that the new server will have... (6 Replies)
Discussion started by: girish.batra
6 Replies

4. Shell Programming and Scripting

Read specific file from a zip archive without extracting

Hi All, I would like to extract specific file from a zip archive. I have a zip archive "sample.zip". sample.zip contains few text files and images... text1.txt, text2.txt, pic.jpg etc... I need to read specific file "text2.txt" from "sample.zip" WITHOUT EXTRACTING the zip file. ... (4 Replies)
Discussion started by: sridharg
4 Replies

5. Programming

read file from tar.gz archive

I want to write a c-program which reads a textfile from a tar.gz archive. How can I do it? (9 Replies)
Discussion started by: krylin
9 Replies

6. Shell Programming and Scripting

Archive::Tar problem

Hello, I have a problem using Archive::Tar. it seem very trivial but i cannot get it work. First I have a list of files I grab from a directory. Then I create a tar archive and write the files into the archive. everything works great, except that I cannot properly extract the files. What... (0 Replies)
Discussion started by: amcrisan
0 Replies

7. Shell Programming and Scripting

Extracting from archive | compressing to new archive

Hi there, I have one huge archive (it's a system image). I need sometime to create smaller archives with only one or two file from my big archive. So I'm looking for a command that extracts files from an archive and pipe them to another one. I tried the following : tar -xzOf oldarchive.tgz... (5 Replies)
Discussion started by: chebarbudo
5 Replies

8. Solaris

Boot-archive Problem

I disabled the boot-archive service by using #svcadm disable svc:/system/boot-archive:default then i rebooted my system but i am unable to boot. It throws the following errors CONSOLE LOGIN SERVICE(S) CANNOT RUN then it automatically asked me for the maintenance mode passwd. i logged... (3 Replies)
Discussion started by: dinu
3 Replies

9. Shell Programming and Scripting

Script to archive logs and sftp to another archive server

Requirement: Under fuse application we have placeholders called containers; Every container has their logs under: <container1>/data/log/fuse.log <container1>/data/log/fuse.log.1 <container1>/data/log/fuse.log.XX <container2>/data/log/fuse.log... (6 Replies)
Discussion started by: Arjun Goswami
6 Replies
ZIPARCHIVE.OPEN(3)							 1							ZIPARCHIVE.OPEN(3)

ZipArchive::open - Open a ZIP file archive

SYNOPSIS
mixed ZipArchive::open (string $filename, [int $flags]) DESCRIPTION
Opens a new zip archive for reading, writing or modifying. PARAMETERS
o $filename - The file name of the ZIP archive to open. o $flags - The mode to use to open the archive. o ZipArchive::OVERWRITE o ZipArchive::CREATE o ZipArchive::EXCL o ZipArchive::CHECKCONS RETURN VALUES
o $Error codes - Returns TRUE on success or the error code. o ZipArchive::ER_EXISTS File already exists. o ZipArchive::ER_INCONS Zip archive inconsistent. o ZipArchive::ER_INVAL Invalid argument. o ZipArchive::ER_MEMORY Malloc failure. o ZipArchive::ER_NOENT No such file. o ZipArchive::ER_NOZIP Not a zip archive. o ZipArchive::ER_OPEN Can't open file. o ZipArchive::ER_READ Read error. o ZipArchive::ER_SEEK Seek error. EXAMPLES
Example #1 Open and extract <?php $zip = new ZipArchive; $res = $zip->open('test.zip'); if ($res === TRUE) { echo 'ok'; $zip->extractTo('test'); $zip->close(); } else { echo 'failed, code:' . $res; } ?> Example #2 Create an archive <?php $zip = new ZipArchive; $res = $zip->open('test.zip', ZipArchive::CREATE); if ($res === TRUE) { $zip->addFromString('test.txt', 'file content goes here'); $zip->addFile('data.txt', 'entryname.txt'); $zip->close(); echo 'ok'; } else { echo 'failed'; } ?> PHP Documentation Group ZIPARCHIVE.OPEN(3)
All times are GMT -4. The time now is 10:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy