08-19-2012
sed: -e expression #1, char 0: no previous regular expression
Thanks RudiC for your response.
I verified the points you have highlighted, and there is no problem with array size & initialization.Anyways, i can assign array size to another variable and use it in while condition.
I'd want you just focus on sed part of it, as it throws error there.
Hope you got me right!
Regards,
Indu
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm trying following:echo "test line XA24433 test" | sed 's/.*X\(.*\)/X\1/'
XA24433 test While I want the output as: XA24433
I want to grab the words starting with letter X till the next space, this word can be anywhere in the line. (9 Replies)
Discussion started by: nervous
9 Replies
2. Shell Programming and Scripting
Hi!
I'm trying to write a regexp but I have no luck...
I have a string like this:
param1=sometext¶m2=hello¶m3=bye
Also, the string can be simply:
param2=hello
I want to return the value of param2: "hello".
How can I do this?
Thanks. (3 Replies)
Discussion started by: GagleKas
3 Replies
3. Shell Programming and Scripting
Hi
I need to get text that are within ""
For example
File:
asdasd "test test2" sadasds asdda asdasd "demo demo2"
Output:
test test2 demo demo2
Any help is good
Thank you (12 Replies)
Discussion started by: blito_loco
12 Replies
4. Shell Programming and Scripting
please consider this:
echo "11111*X*005010X279~ST*270*1111111*005010X279~BHT*0011*11" | sed 's/.*\(005010X(\d)(\d)(\d)*\).*$/\1/'i'm searching for first occurrence of 005010X while leaving rest of characters out.
:confused:
any tips? thnx in advance guys. (7 Replies)
Discussion started by: grep01
7 Replies
5. Shell Programming and Scripting
CA_RELEASE has a value of 6. I need to check if that this is a numeric value. if not error.
source $CA_VERSION_DATA
if * ]
then
echo "CA_RELESE $CA_RELEASE is invalid"
exit -1
fi
+ source /etc/ncgl/ca_version_data
++ CA_PRODUCT_ID=samxts
++ CA_RELEASE=6
++ CA_WEEK_NO=7
++... (3 Replies)
Discussion started by: ketkee1985
3 Replies
6. UNIX for Dummies Questions & Answers
Hi ,
I am learing sed
echo abc 123 def 456 | sed 's|\(*\) \(*\)|\1|'
is returning abc def 456
i was hoping abc def "\1" should only print the occurence of the first pattern
but according to my understanding it is just removing the first occurence of the second pattern... (7 Replies)
Discussion started by: max_hammer
7 Replies
7. Shell Programming and Scripting
I have read many threads, but I still didn't find the right answer. May be i didn't find the right thread, though are so many threads for the same question.
Basically the situation is - find date in a file and replace it with another date. (its not homework, its part of lot of a big processing,... (10 Replies)
Discussion started by: avinthm
10 Replies
8. Programming
Hi all,
How am I read a file, find the match regular expression and overwrite to the same files.
open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat";
open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat";
while (<DESTINATION_FILE>)
{
# print... (1 Reply)
Discussion started by: jessy83
1 Replies
9. Shell Programming and Scripting
Hi , I need to remove pipe character from a |^ delimeted file.
Something like |^tran|sformers||^|revenge |of fallen|^ to
|^transformers|^revenge of fallen|^...
Cold anybody please help to build the regular expression using sed .
many thanks.
Please use code tags next time for... (1 Reply)
Discussion started by: kokjek
1 Replies
LEARN ABOUT HPUX
initstate
random(3M) random(3M)
NAME
random(), srandom(), initstate(), setstate() - generate a pseudorandom number
SYNOPSIS
DESCRIPTION
The and functions are random-number generators that have virtually the same calling sequence and initialization properties as the and func-
tions, but produce sequences that are more random. The low 12 bits generated by the function go through a cyclic pattern, while all the
bits generated by the function are usable. For example, produces a random binary value.
The function uses a nonlinear additive feedback random-number generator employing a default state array size of 31 long integers to return
successive pseudorandom numbers in the range from 0 to The period of this random-number generator is approximately 16 x The size of the
state array determines the period of the random-number generator. Increasing the state array size increases the period.
With 256 bytes of state information, the period of the random-number generator is greater than
Like the function, the function produces by default a sequence of numbers that can be duplicated by calling the function with a value of 1
as the seed.
The function initializes the current state array using the value of seed.
The and functions handle restarting and changing random-number generators. The function allows a state array, pointed to by the state
argument, to be initialized for future use. The size argument, which specifies the size in bytes of the state array, is used by the func-
tion to decide how sophisticated a random-number generator to use; the larger the state array, the more random the numbers. Values for the
amount of state information are 8, 32, 64, 128, and 256 bytes. Amounts less than 8 bytes return a NULL pointer, while other amounts are
rounded down to the nearest known value. The seed argument specifies a starting point for the random-number sequence and provides for
restarting at the same point. The function returns a pointer to the previous state information array.
Once a state has been initialized, the function allows switching between state arrays. The array defined by the state argument is used for
further random-number generation until the function is called or the function is called again. The function returns a pointer to the pre-
vious state array.
After initialization, a state array can be restarted at a different point in one of two ways:
The function can be used, with the desired seed, state array, and size of the array.
The function, with the desired state, can be used, followed by the function with the desired seed. The advantage of using both of
these functions is that the size of the state array does not have to be saved once it is initialized.
RETURN VALUE
The function returns the generated pseudorandom number.
The function returns no value.
Upon successful completion, the and functions return a pointer to the previous state array. Otherwise, a NULL pointer is returned.
ERRORS
If the function detects that the state information has been damaged, error messages are written to standard error.
SEE ALSO
drand48(3C), rand(3C), random(7).
STANDARDS CONFORMANCE
random(3M)