08-27-2006
string parser
I am new to scripting
I want to parse a string in a loop
eg A:B:C
E:F:G:H
and put them in different variable
attr1 = A
attr2 = B
attr3 = C
attr4 = D
.
.
/* do processing with attr1, attr2, attr3 and attr4 */
then go to next line E:F:G:H and again assign attr1/attr2/attr3/attr4 with E,F,G and H
Strings I am reding from file line by line. In a line, string can be of any size
for example
A:B:C
E:F:G:H
I:J:K:L:M:N
Could you please guide how should be my bash shell script
Last edited by flextronics; 08-27-2006 at 07:01 AM..
10 More Discussions You Might Find Interesting
1. Programming
hey peeps
i need to allow a user to input a line and then my job is to separate that line into tokens and print out what each command is. my question here is, if eg: 'ls > aifle' is entered as the input line, you would separate it and get three tokens: token 1 would be 'ls', token 2 '>' and... (0 Replies)
Discussion started by: mile1982
0 Replies
2. Shell Programming and Scripting
I am having a text file as follows
say server.txt
Date Time server ip error code
--------------------------------------------------------------------------
02/21/2008 18:10:14 server1 xxx.xxx.xxx.xxx 6
02/21/2008 08:10:14 server2 ... (8 Replies)
Discussion started by: karthikn7974
8 Replies
3. Shell Programming and Scripting
Hello, i'm workig with a file with structural information about biological macromolecules (proteins etc).
In a certain file, the info is structured like this
@<TRIPOS>MOLECULE
blah 1
blah 2
blah 3
@<TRIPOS>MOLECULE
foo 1
foo 2
foo 3
@<TRIPOS>MOLECULE
mmm 1
mmm 2
mmm 3
I would... (7 Replies)
Discussion started by: aristegui
7 Replies
4. Shell Programming and Scripting
i need a simple text parser which can parse a data file created by a softwre so that i can export it to my mysqldb,, datafile created as one record per line with different number of fields.
e.g datafile contains following.
a=1, b=3, c=4
a=1, c=55, d=abcd
a=5, b=hello, c=99, d=help
now i... (12 Replies)
Discussion started by: sfaizan
12 Replies
5. Shell Programming and Scripting
Hi,
I have this variable:
<a href="http://www.rtve.es/mediateca/videos/20100916/video-calamares-rellenos-salsa-pimientos-garbanzos-16-09-10/878586.shtml">V�deo: Calamares rellenos con salsa de pimientos y ...</a>
I would like to have:
... (7 Replies)
Discussion started by: mierdatuti
7 Replies
6. Programming
Hi Everyone
I have an out put of multiple lines
which I would like to parse and retrieve certain info from it.
The output consists of multiple sections that starts with the line Client:
and ends with STL tag: each section separated by an empty line.
So basically somehting like
Client: ... (10 Replies)
Discussion started by: bombcan1
10 Replies
7. Shell Programming and Scripting
Hi
need help parsing a file.
I have tag fields and values in a file with delimiter |.
sample records from the file listed below
8=value|9=value|35=value|49=value|56=value|34=value|50=value|48=value|10=value
8=value|9=value|35=value|49=value|56=value|34=value|51=value|48=value|10=value... (2 Replies)
Discussion started by: subramanian
2 Replies
8. Shell Programming and Scripting
Hi,
I have been assigned a task to migrate few thousands of sql scripts to a different db format. there could be sub queries and complex joins. there would be functions that needs to be replaced from a given list to another values. this should also parse the sub\inline queries. Can you please... (1 Reply)
Discussion started by: hitmansilentass
1 Replies
9. Shell Programming and Scripting
Hi All,
I am trying to create a parser to find out what cobol programs are being called by which JCL's.
I need to search recursively until the main cobol program is found being called by a JCL.
I tried to create a script but I am not able to generalize it. Can someone please help.
... (1 Reply)
Discussion started by: nua7
1 Replies
10. UNIX for Beginners Questions & Answers
input
1..100km
112..403km
500..623km
required output
1..51
112..162
500..550
(i.e 50kms added to the initial distance) (2 Replies)
Discussion started by: ANKIT ROY
2 Replies
LEARN ABOUT DEBIAN
bup-margin
bup-margin(1) General Commands Manual bup-margin(1)
NAME
bup-margin - figure out your deduplication safety margin
SYNOPSIS
bup margin [options...]
DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two
entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids.
For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit
hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by
its first 46 bits.
The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits,
that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits
with far fewer objects.
If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if
you're getting dangerously close to 160 bits.
OPTIONS
--predict
Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer
from the guess. This is potentially useful for tuning an interpolation search algorithm.
--ignore-midx
don't use .midx files, use only .idx files. This is only really useful when used with --predict.
EXAMPLE
$ bup margin
Reading indexes: 100.00% (1612581/1612581), done.
40
40 matching prefix bits
1.94 bits per doubling
120 bits (61.86 doublings) remaining
4.19338e+18 times larger is possible
Everyone on earth could have 625878182 data sets
like yours, all in one repository, and we would
expect 1 object collision.
$ bup margin --predict
PackIdxList: using 1 index.
Reading indexes: 100.00% (1612581/1612581), done.
915 of 1612581 (0.057%)
SEE ALSO
bup-midx(1), bup-save(1)
BUP
Part of the bup(1) suite.
AUTHORS
Avery Pennarun <apenwarr@gmail.com>.
Bup unknown- bup-margin(1)