07-03-2012
hey, thanks for the quick response! It works perfectly for the ordered dataset.
Would it take much to adapt it to do the following:
1. Ignore a header line (i..e line 1)
2. Work with a non-ordered flatfile as per my edit above.
Even if not, this is great - would have taken me hours to come up with!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a file which is fixed width columns. This is an offset buffer - rather than space or tab delimited. There are upto about 8 columns and I need to get all of the column 5's values into another file.
The problem is that because the delimiter is a space - and some fields are blank - the 5th... (3 Replies)
Discussion started by: peter.herlihy
3 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am new to unix. I have a flat file that needs to be pgp encyrpted in ASCII format and ftped in Ascii format to remote location.
Can any one tell me the steps involved in the pgp encryption of the unix file. I will really appreciate if any one can help me with the pgp encryption shell... (1 Reply)
Discussion started by: rkumar28
1 Replies
3. Shell Programming and Scripting
Hi,
I need to check a flatfile for various parameters like length of the record, format of record, any tab character present in the record etc.,
for checking presence of tab character, i'm trying to use the following code and i'm not sure if the same is right. Pls Help.
nawk '{print... (1 Reply)
Discussion started by: aravindc
1 Replies
4. Shell Programming and Scripting
I have a set of flatfiles which have columns delimited by #. How can a particular column be deleted in all the flatfiles. All flatfiles have same number of columns. (5 Replies)
Discussion started by: rsprabha
5 Replies
5. UNIX for Advanced & Expert Users
Hi all,
Am looking for a way to generate XML based on XSDs so that the final XML need not be validated against the XSDs again.
Here is the part of the XSD
<xsd:element name="first_element">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="val"/>
</xsd:sequence>
... (0 Replies)
Discussion started by: matrixmadhan
0 Replies
6. Shell Programming and Scripting
Hi all,
Have to generate an xml having information related to files in the directory
Suppose i have file
file1.xml (datafile)
file2.xml (datafile)
file3.xml (metafile)
Now i need to generate an xml in the format >>
<?xml version="1.0" encoding="UTF-8"?>
<AuditFile Version="2.0">... (8 Replies)
Discussion started by: abhinav192
8 Replies
7. UNIX for Advanced & Expert Users
Hi,
I have the below script to check the count of delimeters for a file (here is File : test.csv Delimeter is ",")
awk '{gsub(/"*"/,x);print gsub(/,/,x)}' test.csv
And it return the output for each line as:
2
2
cat test.csv:
abc,xyz
"abc,zxyz",1
I need help one the below things:
- IS... (8 Replies)
Discussion started by: venkatajay_18
8 Replies
8. Shell Programming and Scripting
Hi,
I am writing one unix script to get row count of few tables into one sequential file
my script is like this
$ORACLE_HOME/bin/sqlplus -s <<EOF >output.txt
userid/password@databasename
set verify off
set heading off
set feedback off
select count(*) count from tablel where ;
select... (4 Replies)
Discussion started by: spmsarada
4 Replies
9. Shell Programming and Scripting
I am trying to parse a file that looks like the below:
There are thousands of lines like the above and the file is expected to run into hundreds of thousands.
The issue i have is the mixed format of the file. If it was just an xmlfile, i would use an xmllint to parse the file. Now, i am... (11 Replies)
Discussion started by: goddevil
11 Replies
10. Shell Programming and Scripting
i have a unix script which generates the csv file. the data in csv file is dynamic. how can i convert/move the data from csv file to xml. please suggest (1 Reply)
Discussion started by: archana25
1 Replies
STRFILE(8) BSD System Manager's Manual STRFILE(8)
NAME
strfile, unstr -- create a random access file for storing strings
SYNOPSIS
strfile [-iorsx] [-c char] source_file [output_file]
unstr source_file
DESCRIPTION
Strfile reads a file containing groups of lines separated by a line containing a single percent '%' sign and creates a data file which con-
tains a header structure and a table of file offsets for each group of lines. This allows random access of the strings.
The output file, if not specified on the command line, is named source_file.out.
The options are as follows:
-c char Change the delimiting character from the percent sign to char.
-i Ignore case when ordering the strings.
-o Order the strings in alphabetical order. The offset table will be sorted in the alphabetical order of the groups of lines refer-
enced. Any initial non-alphanumeric characters are ignored. This option causes the STR_ORDERED bit in the header str_flags field
to be set.
-r Randomize access to the strings. Entries in the offset table will be randomly ordered. This option causes the STR_RANDOM bit in
the header str_flags field to be set.
-s Run silently; don't give a summary message when finished.
-x Note that each alphabetic character in the groups of lines is rotated 13 positions in a simple caesar cypher. This option causes
the STR_ROTATED bit in the header str_flags field to be set.
The format of the header is:
#define VERSION 1
unsigned long str_version; /* version number */
unsigned long str_numstr; /* # of strings in the file */
unsigned long str_longlen; /* length of longest string */
unsigned long str_shortlen; /* length of shortest string */
#define STR_RANDOM 0x1 /* randomized pointers */
#define STR_ORDERED 0x2 /* ordered pointers */
#define STR_ROTATED 0x4 /* rot-13'd text */
unsigned long str_flags; /* bit field for flags */
char str_delim; /* delimiting character */
All fields are written in network byte order.
The purpose of unstr is to undo the work of strfile. It prints out the strings contained in the file source_file in the order that they are
listed in the header file source_file.dat to standard output. It is possible to create sorted versions of input files by using -o when
strfile is run and then using unstr to dump them out in the table order.
SEE ALSO
byteorder(3), fortune(6)
FILES
strfile.out default output file.
HISTORY
The strfile utility first appeared in 4.4BSD.
4th Berkeley Distribution June 9, 1993 4th Berkeley Distribution