10-19-2009
Searching using awk - Help required
Hi...
I am working on script to search some records in a file based on certain fields and each record is a ASCII fixed size. I was using awk to search based on certain condition. But the length of the record is too much that awk is giving
syntax error near unexpected token `('
Request urgent help on this or any other idea.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi there,
im writing some script in awk; in few words i have a list from router (mac address- ip address) and the second list with only the mac addresses.
the thing is that i want search list from router for the first mac address; if found - print the ip address, if not print error; then search... (1 Reply)
Discussion started by: mac7
1 Replies
2. Shell Programming and Scripting
Hi,
I have a fixed with file, which have almost 10 records
Sample File:
------------
AR 100 TTT
BC 200 SSS
DA 199 YYY
AR 500 RRR
PO 300 QQQ
PB 800 PPP
PC 150 OOO
AR 111 CCC
AD 321 LLL
I Have to check for first two charactors and if its 'AR' i have to save those records to one... (3 Replies)
Discussion started by: meetavin
3 Replies
3. Shell Programming and Scripting
Hi, I wonder if anybody could help. How do i awk out (or indeed using another utility) a particular value that exists within a defined block, for example if i have a file that looks like the one below and i want to get at the "Product Serial" for the block referring to "mb.fru" (bolded and coloured... (4 Replies)
Discussion started by: rethink
4 Replies
4. Shell Programming and Scripting
Hi All,
I have 2 .csv files as below
File1.csv
name1,20,30,date1
name2,30,40,date1
File2.csv
name1,25,35,date1
name2,45,55,date1
Can any one help me to add the 2nd and 3rd column of file1 and file2 and write the output into a new file as below
name1,45,65,date1... (9 Replies)
Discussion started by: ajay547
9 Replies
5. Shell Programming and Scripting
hi all,
Please can you help me with the awk searching where:
I have a master file where I need the string $12.
the string $ 12 varies between 3 and 4 characters and I need to bring only the characters ending in 68.
try this, but is so bad my search i know
awk-F, '(if... (8 Replies)
Discussion started by: manzi
8 Replies
6. Shell Programming and Scripting
Hi all,
I have some data in the form of
adc|nvhs|nahssn|njadnk|nkfds
in the above data i need to write a script so thet it will append "|||" to the third occurnace in the string ..... the outout should look like
adc|nvhs|nahssn||||njadnk|nkfds
Thanks,
Firestar. (6 Replies)
Discussion started by: firestar
6 Replies
7. Shell Programming and Scripting
Hello, I am trying to get an output from awk and have been unsuccessful so far.
There is an input file which contains certain segments, that needs to be read and append with another data after matching the segment...
Input file is as shown below
ISA*00* *00* *01*781495650... (2 Replies)
Discussion started by: rakeshv
2 Replies
8. Shell Programming and Scripting
Hi all,
i am trying to count the number of logical processors from the below output:
# print_manifest | grep "logical processors"
8 cores, 16 logical processors per socket
2 logical processors (2 per socket)
i just want to have below output :
16
2
also... (11 Replies)
Discussion started by: omkar.jadhav
11 Replies
9. Shell Programming and Scripting
i m searching a zone file my domain name is abcd.com
my zone file looks like this.
abcd.com. IN SOA ns1.abcd.com. root.abcd.com. (
abcd.com. 400 IN A 15.1.1.1
Then i am searching that abcd.com have if below ip... (14 Replies)
Discussion started by: learnbash
14 Replies
10. Shell Programming and Scripting
I need to create one script in which I want to search in txt file , this txt file is having 10 columns , I want to check 4th column value if "BOY" & 10th column value =>500 it will print 4th column row value ,1st column row value & 10th column row value & store the same value in one file as... (2 Replies)
Discussion started by: dravi_laxmi
2 Replies
cdb(5) File Formats Manual cdb(5)
NAME
cdb - Constant DataBase file format
DESCRIPTION
A cdb database is a single file used to map `keys' to `values', having records of (key,value) pairs. File consists of 3 parts: toc (table
of contents), data and index (hash tables).
Toc has fixed length of 2048 bytes, containing 256 pointers to hash tables inside index sections. Every pointer consists of position of a
hash table in bytes from the beginning of a file, and a size of a hash table in entries, both are 4-bytes (32 bits) unsigned integers in
little-endian form. Hash table length may have zero length, meaning that corresponding hash table is empty.
Right after toc section, data section follows without any alingment. It consists of series of records, each is a key length, value (data)
length, key and value. Again, key and value length are 4-byte unsigned integers. Each next record follows previous without any special
alignment.
After data section, index (hash tables) section follows. It should be looked to in conjunction with toc section, where each of max 256
hash tables are defined. Index section consists of series of hash tables, with starting position and length defined in toc section. Every
hash table is a sequence of records each holds two numbers: key's hash value and record position inside data section (bytes from the begin-
ning of a file to first byte of key length starting data record). If record position is zero, then this is an empty hash table slot,
pointed to nowhere.
CDB hash function is
hv = ((hv << 5) + hv) ^ c
for every single c byte of a key, starting with hv = 5381.
Toc section indexed by (hv % 256), i.e. hash value modulo 256 (number of entries in toc section).
In order to find a record, one should: first, compute the hash value (hv) of a key. Second, look to hash table number hv modulo 256. If
it is empty, then there is no such key exists. If it is not empty, then third, loop by slots inside that hash table, starting from slot
with number hv divided by 256 modulo length of that table, or ((hv / 256) % htlen), searching for this hv in hash table. Stop search on
empty slot (if record position is zero) or when all slots was probed (note cyclic search, jumping from end to beginning of a table). When
hash value in question is found in hash table, look to key of corresponding record, comparing it with key in question. If them of the same
length and equals to each other, then record is found, overwise, repeat with next hash table slot. Note that there may be several records
with the same key.
SEE ALSO
cdb(1), cdb(3).
AUTHOR
The tinycdb package written by Michael Tokarev <mjt@corpit.ru>, based on ideas and shares file format with original cdb library by Dan
Bernstein.
LICENSE
Public domain.
Apr, 2005 cdb(5)