10-25-2001
1) Use an editor to create a file and type in the code. I will call it "printblock".
2) Make the script executable with "chmod +x printblock".
3) Run the script and redirect input from your file. "./printblock < datafile". You may want to save the output to a second file. You can do that with "./printblock < datafile > secondfile".
Now I don't want to sound unkind, but if you're struggling with concepts like running a script and redirecting input, then you shouldn't be trying to write complex scripts yet. You need to walk before you run. I strongly recommend that you spend some time on unix basics via a book or class.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi , this is my first enty in our forum.
Problem scenario:
Using informatica tool am loding records from source DB to target DB. While loading some records getting rejected due to some reason. Informatica will capture those rejected records in session log file.now the session log ll be... (2 Replies)
Discussion started by: Gopal_Engg
2 Replies
2. Shell Programming and Scripting
Hi,
There's an xml file produced from a front-end tool as shown below:
<INPUT DATABASE ="ORACLE" DBNAME ="UNIX" NAME ="FACT_TABLE" OWNERNAME ="DIPS">
<INPUTFIELD DATATYPE ="double" DEFAULTVALUE ="" DESCRIPTION ="" NAME ="STORE_KEY" PICTURETEXT ="" PORTTYPE ="INPUT" PRECISION ="15" SCALE... (6 Replies)
Discussion started by: dips_ag
6 Replies
3. Shell Programming and Scripting
Hello all,
I have a large output file from which I would like to extract a single block of text.
An example block of text is shown below:
***** EQUILIBRIUM GEOMETRY LOCATED *****
COORDINATES OF ALL ATOMS ARE (ANGS)
ATOM CHARGE X Y Z
... (10 Replies)
Discussion started by: marcozd
10 Replies
4. Shell Programming and Scripting
Hi,
I have some CVS log files, which are divided into blocks. Each block has many fields of information and I want to extract those blocks with a pattern. Here is the sample input.
RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java,v
head: 1.174... (7 Replies)
Discussion started by: sandeepk1611
7 Replies
5. Shell Programming and Scripting
I have siebel log file as following
EventContext .......
123
.......
SELECT
...
..
EventConext <---- Question 1 , I should get this line
345
......
SELECT <----- Question 2 , print this line
Test..... <----- Question 2 , print this line
.... <----- Question 2 , print... (5 Replies)
Discussion started by: ran123
5 Replies
6. UNIX for Advanced & Expert Users
I have a "main" file which has blocks of data for each user defined by tags BEGIN and END.
BEGIN
ID_NUM:24879
USER:abc123
HOW:47M
CMD1:xyz1
CMD2:arp2
STATE:active
PROCESS:id60
END
BEGIN
ID_NUM:24880
USER:def123
HOW:4M
CMD1:xyz1
CMD2:xyz2
STATE:running
PROCESS:id64
END (7 Replies)
Discussion started by: grep_me
7 Replies
7. Shell Programming and Scripting
I want to process a file block by block using sed, and if that block does not contain two patterns, then that complete block has to be printed.
See below for the example data.
................................server 1...............................
running process 1
running... (8 Replies)
Discussion started by: Kesavan
8 Replies
8. Shell Programming and Scripting
Hello all,
I am working on a script which should parse a large file called input.txt which contains table definitions, index definitions and comments like these ones:
------------------------------------------------
-- DDL Statements for table "CMWSYS"."CMWD_TEC_SUIVI_TRT"... (12 Replies)
Discussion started by: kiki_riki_miki
12 Replies
9. Shell Programming and Scripting
I want to extract XML block surrounding search string
Ex: print XML block for string "myapp1-ear" surrounded by "<application> .. </application>"
Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<deployment-request>
<requestor>
<first-name>kchinnam</first-name>
... (16 Replies)
Discussion started by: kchinnam
16 Replies
10. UNIX for Beginners Questions & Answers
Hi everyone,
So i'm struggling with an xml (log file) where we get information about some devices, so the logfile is filled with multiple "blocks" like that.
Based on the <devId> i want to extract this part of the xml file. If possible I want it to have an script for this, cause we'll use... (5 Replies)
Discussion started by: Pouky
5 Replies
FIZ(1) General Commands Manual FIZ(1)
NAME
fiz - analyze damaged zoo archive for data revovery
SYNOPSIS
fiz archive[.zoo]
DESCRIPTION
Fiz is used to analyze damaged zoo archives and locate directory entries and file data in them. The current version of fiz is 2.0 and it
is meant to be used in conjunction with zoo version 2.0. Fiz makes no assumptions about archive structure. Instead, it simply searches
the entire subject archive for tag values that mark the locations of directory entries and file data. In a zoo archive, a directory entry
contains information about a stored file such as its name, whether compressed or not, and its timestamp. The file data are the actual data
for the archived file, and may be either the original data, or the result of compressing the file.
For each directory entry found, fiz prints where in the archive it is located, the directory path and filename(s) found in it, whether the
directory entry appears to be corrupted (indicated by [*CRC Error*]), and the value of the pointer to the file data that is found in the
directory entry. For each block of file data found in the archive, fiz prints where in the archive the block begins. In the case of an
undamaged archive, the pointer to file data found in a directory entry will correspond to where fiz actually locates the data. Here is
some sample output from fiz:
****************
2526: DIR [changes] ==> 95
2587: DATA
****************
3909: DIR [copyrite] ==> 1478
3970: DATA
4769: DATA
****************
In such output, DIR indicates where fiz found a directory entry in the archive, and DATA indicates where fiz found file data in the ar-
chive. Filenames located by fiz are enclosed in square brackets, and the notation "==> 95" indicates that the directory entry found by
fiz at position 2526 has a file data pointer to position 95. In actuality, fiz found file data at positions 2587, 3970, and 4769. Since
fiz found only two directory entries, and each directory entry corresponds to one file, one of the file data positions is an artifact.
Once the locations of directory entries and file data are found, the @ modifier to zoo's archive list and extract commands can be used and
the archive contents selectively listed or extracted, skipping the damaged portion. This is further described in the documentation for
zoo(1).
In the above case, commands to try giving to zoo might be x@2526,2587 (extract beginning at position 2526, and get file data from position
2587), x@3090,3970 (extract at 3090, get data from 3970) and x@3909,4769 (extract at 3909, get data from 4769). Once a correctly-matched
directory entry/file data pair is found, zoo will in most cases synchronize with and correctly extract all files subsequently found in the
archive. Trial and error should allow all undamaged files to be extracted. Also note that self-extracting archives created using sez (the
Self-Extracting Zoo utility for MS-DOS), which are normally executed on an MS-DOS system for extraction, can be extracted on non-MSDOS sys-
tems in a similar way.
SEE ALSO
zoo(1)
BUGS
Random byte patterns can occasionally be incorrectly recognized as tag values. This occurs very rarely, however, and trial and error will
usually permit all undamaged data to be extracted.
DIAGNOSTICS
Fiz always exits with a status code of 0.
FUTURE DIRECTIONS
Automation of data recovery from a damaged archive is potentially achievable. However, since damaged archives occur only rarely, fiz as it
currently stands is unlikely to change much in the near future.
AUTHOR
Rahul Dhesi
Jan 31, 1988 FIZ(1)