Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Linux read specific content file from tar.gz files without extracting Post 303006469 by RudiC on Thursday 2nd of November 2017 12:50:02 PM
Old 11-02-2017
Not necessarily - you can implement recursion by other means, e.g. the find command.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Is extracting specific files from a zip file possible?

If a zip file contains several zip files, but if the file names of the files needed are known, is there a variation of the unzip command that will allow those few (individual) files to be extracted? --- Example: Zip file name: zip.zip unzip -l zip.zip will display file01, file02, file03, etc.... (1 Reply)
Discussion started by: HLee1981
1 Replies

2. Shell Programming and Scripting

bash - batch script for extracting one file from multiple tar files

so i have hundreds of files named history.20071112.tar (history.YYYYMMDD.tar) and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis here is what i have so far: for FILE in `cat dirlist` do tar xvf $FILE ./status_* done dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies

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

4. Shell Programming and Scripting

How to read the content of the particular file from tar.Z without extracting?

Hi All, I want to read the content of the particular file from tar.Z without extracting. aaa.tar.Z contains a file called one.txt, I want to read the content of the one.txt without extracting. Please help me to read the content of it. Regards, Kalai. (12 Replies)
Discussion started by: kalpeer
12 Replies

5. Shell Programming and Scripting

Extracting .tar files.

Hey guys complete n00b here so I'll try my best at explaining. I'm creating a backup and restore utility and decided to use tar. I create a backup folder in each user's account and when backing up (say word processing files), I use the following: tar cvf /home/user/backup/wpbackup.tar... (2 Replies)
Discussion started by: EwanD
2 Replies

6. UNIX for Dummies Questions & Answers

Extracting specific files from a tar file in HP-UX

I have tried: tar -xfv mytarfile.tar archive/tabv/* tar -xfv mytarfile.tar --wildcards 'archive/tabv/*' tar -xf mytarfile.tar -v --wildcards 'archive/tabv/*' tar -xfv mytarfile.tar --wildcards --no-anchored 'archive/tabv/*' tar -xfv mytarfile.tar --wildcards `archive/tabv/*` and none... (5 Replies)
Discussion started by: zapper222
5 Replies

7. UNIX for Advanced & Expert Users

extracting multuiple tar files with while and read

Is anyone out there? I'm trying to run a script i wrote that extracts multiple .tar files in succession by pasting it into standard input. It does extract them all but I cant get it to stop looping and when I hit enter I get a tar command error like its still looking for files to extract. ie; ... (2 Replies)
Discussion started by: commoja
2 Replies

8. Shell Programming and Scripting

Extracting content from a file in specific format

Hi All, I have the file in this format **** Results Data **** Time or Step 1 2 20 0.000000000e+00 0s 0s 0s 1.024000000e+00 Us 0s 0s 1.100000000e+00 1s 0s 0s 1.100000001e+00 1s 0s 1s 2.024000000e+00 Us Us 1s 2.024000001e+00 ... (7 Replies)
Discussion started by: diehard
7 Replies

9. Red Hat

Moving of file content to another two files after searching with specific pattern

Hello, Please help me with this!! Thanks in advance!! I have a file named file.gc with the content: 1-- Mon Sep 10 08:53:09 CDT 2012 2revoke connect from FR2261; 3delete from mkt_allow where grantee = 'FR2261'; 4grant connect to FR2261 with '******'; 5alter user FR2261 comment... (0 Replies)
Discussion started by: raosr020
0 Replies

10. Shell Programming and Scripting

I want to read the content of a specific folder

Why does not work a cd in a shell schript file. How do you get to run it? I use these code: #!/bin/sh cd workspace array=($(ls -d */)) echo ${array} But it doesn't change to workspace editby bakunin: please user CODE-tags as required by the rules. Thank you. (12 Replies)
Discussion started by: Linuxmann
12 Replies
PCRESTACK(3)						     Library Functions Manual						      PCRESTACK(3)

NAME
PCRE - Perl-compatible regular expressions PCRE DISCUSSION OF STACK USAGE
When you call pcre_exec(), it makes use of an internal function called match(). This calls itself recursively at branch points in the pat- tern, in order to remember the state of the match so that it can back up and try a different alternative if the first one fails. As match- ing proceeds deeper and deeper into the tree of possibilities, the recursion depth increases. Not all calls of match() increase the recursion depth; for an item such as a* it may be called several times at the same level, after matching different numbers of a's. Furthermore, in a number of cases where the result of the recursive call would immediately be passed back as the result of the current call (a "tail recursion"), the function is just restarted instead. The pcre_dfa_exec() function operates in an entirely different way, and hardly uses recursion at all. The limit on its complexity is the amount of workspace it is given. The comments that follow do NOT apply to pcre_dfa_exec(); they are relevant only for pcre_exec(). You can set limits on the number of times that match() is called, both in total and recursively. If the limit is exceeded, an error occurs. For details, see the section on extra data for pcre_exec() in the pcreapi documentation. Each time that match() is actually called recursively, it uses memory from the process stack. For certain kinds of pattern and data, very large amounts of stack may be needed, despite the recognition of "tail recursion". You can often reduce the amount of recursion, and therefore the amount of stack used, by modifying the pattern that is being matched. Consider, for example, this pattern: ([^<]|<(?!inet))+ It matches from wherever it starts until it encounters "<inet" or the end of the data, and is the kind of pattern that might be used when processing an XML file. Each iteration of the outer parentheses matches either one character that is not "<" or a "<" that is not followed by "inet". However, each time a parenthesis is processed, a recursion occurs, so this formulation uses a stack frame for each matched char- acter. For a long string, a lot of stack is required. Consider now this rewritten pattern, which matches exactly the same strings: ([^<]++|<(?!inet))+ This uses very much less stack, because runs of characters that do not contain "<" are "swallowed" in one item inside the parentheses. Recursion happens only when a "<" character that is not followed by "inet" is encountered (and we assume this is relatively rare). A pos- sessive quantifier is used to stop any backtracking into the runs of non-"<" characters, but that is not related to stack usage. This example shows that one way of avoiding stack problems when matching long subject strings is to write repeated parenthesized subpat- terns to match more than one character whenever possible. Compiling PCRE to use heap instead of stack In environments where stack memory is constrained, you might want to compile PCRE to use heap memory instead of stack for remembering back- up points. This makes it run a lot more slowly, however. Details of how to do this are given in the pcrebuild documentation. When built in this way, instead of using the stack, PCRE obtains and frees memory by calling the functions that are pointed to by the pcre_stack_malloc and pcre_stack_free variables. By default, these point to malloc() and free(), but you can replace the pointers to cause PCRE to use your own functions. Since the block sizes are always the same, and are always freed in reverse order, it may be possible to implement customized memory handlers that are more efficient than the standard functions. Limiting PCRE's stack usage PCRE has an internal counter that can be used to limit the depth of recursion, and thus cause pcre_exec() to give an error code before it runs out of stack. By default, the limit is very large, and unlikely ever to operate. It can be changed when PCRE is built, and it can also be set when pcre_exec() is called. For details of these interfaces, see the pcrebuild and pcreapi documentation. As a very rough rule of thumb, you should reckon on about 500 bytes per recursion. Thus, if you want to limit your stack usage to 8Mb, you should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can support around 128000 recursions. The pcretest test program has a command line option (-S) that can be used to increase the size of its stack. Changing stack size in Unix-like systems In Unix-like environments, there is not often a problem with the stack unless very long strings are involved, though the default limit on stack size varies from system to system. Values from 8Mb to 64Mb are common. You can find your default limit by running the command: ulimit -s Unfortunately, the effect of running out of stack is often SIGSEGV, though sometimes a more explicit error message is given. You can nor- mally increase the limit on stack size by code such as this: struct rlimit rlim; getrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = 100*1024*1024; setrlimit(RLIMIT_STACK, &rlim); This reads the current limits (soft and hard) using getrlimit(), then attempts to increase the soft limit to 100Mb using setrlimit(). You must do this before calling pcre_exec(). Changing stack size in Mac OS X Using setrlimit(), as described above, should also work on Mac OS X. It is also possible to set a stack size when linking a program. There is a discussion about stack sizes in Mac OS X at this web site: http://developer.apple.com/qa/qa2005/qa1419.html. AUTHOR
Philip Hazel University Computing Service Cambridge CB2 3QH, England. REVISION
Last updated: 09 July 2008 Copyright (c) 1997-2008 University of Cambridge. PCRESTACK(3)
All times are GMT -4. The time now is 07:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy