I need to echo and export each variable like TEST, WORK. DEL
If:
1) your input is guaranteed to be properly delimited by single blanks always,
2) the item=value pairs will contain no further spaces
then the following may work, provided that you use a common shell (and not Ubuntus standard shell dash). Notice that you may need to add additional tests, trims and other measures to this skeleton because real-world input might not be as well-behaved as is ideal:
Note also that the input string is tokenized backwards, so that the input a=b c=d e=f will result in:
Hello all, need a little help.
I have an input variable such as ARGV which equals something like
/use/home/name/script/test.dat
I need to be able to get just the "test.dat" (i.e. the file name) at the end of the directory and the directory can be anything and any length. To put it another... (3 Replies)
I have a variable (it is a date actually -> 2007-01-03) which
would be passed in as parameter, what I want is to parse in and put
year, month, and day in separate variables, I have tried the following
but doesn't work
echo $dt | awk -F- '{print $1 $2 $3}' | read y m d
Thanks in... (2 Replies)
Hello,
Is there a quick way to parse the values from a variable?
The variable has the following sample input:
TA=
The values of the TA variable is not fixed/hardcoded
Basically I need to get the IV_Test and PF_SAPP_FWK values.
I created a script that first use sed to remove ,... (3 Replies)
I have a variable which has a full path to the file, for example :
A=/t1/bin/f410pdb
Does anybody know the command to parce this variable and assign the result to 3 other variables so each subdirectory name will be in a new variable like this
B=t1
C=bin
D=f410pdb
Many thanks -A (5 Replies)
Hi,
I need to parse a simple text file like below and store the word that starts with BR* to a variable say $BRno. I need to do this in sh script.
NOTE: the length of the numbers following BR is in constant. And there is only 1 BRXXX in a file at a given time.
.txt file:
BR276828... (1 Reply)
Hi,
I need to parse a simple text file like below and store the word that starts with BR* to a variable say $BRno. I need to do this in sh script.
NOTE: the length of the numbers following BR is not constant (eg: it could be BR1234 or BR22233). And there is only 1 BRxxxxx in a file at a given... (6 Replies)
I have a script with few pre defined variables.
Also have a config file. Something like this.
# config file
# Define Oracle User
MOD1_TAG=abcde
MOD2_TAG=xyzabc
MOD3_TAG=def
I need to parse the config file and have each of the value copied to different variables.
Please suggest what... (1 Reply)
In the wake of the post: how-parse-following-xml-file
Thank you for the very useful chakrapani response 302355585-post4 !
A close question.
How to pass a file to xmllint in variable?
For example, let it be:
NEARLY_FILE='<?xml version="1.0" encoding="iso-8859-1"?><html><set label="09/07/29"... (0 Replies)
Im trying to search for a single variable in the first field and from that output use awk to extract out the lines that contain a value less than a value stored in another variable. Both the variables are associated with each other.
Any guidance is appreciated.
File that contains the... (6 Replies)
Discussion started by: ncwxpanther
6 Replies
LEARN ABOUT SUNOS
setbuf
setbuf(3C) Standard C Library Functions setbuf(3C)NAME
setbuf, setvbuf - assign buffering to a stream
SYNOPSIS
#include <stdio.h>
void setbuf(FILE *stream, char *buf);
int setvbuf(FILE *stream, char *buf, int type, size_t size);
DESCRIPTION
The setbuf() function may be used after the stream pointed to by stream (see intro(3)) is opened but before it is read or written. It
causes the array pointed to by buf to be used instead of an automatically allocated buffer. If buf is the null pointer, input/output will
be completely unbuffered. The constant BUFSIZ, defined in the <stdio.h> header, indicates the size of the array pointed to by buf.
The setvbuf() function may be used after a stream is opened but before it is read or written. The type argument determines how stream
will be buffered. Legal values for type (defined in <stdio.h>) are:
_IOFBF Input/output to be fully buffered.
_IOLBF Output to be line buffered; the buffer will be flushed when a NEWLINE is written, the buffer is full, or input is
requested.
_IONBF Input/output to be completely unbuffered.
If buf is not the null pointer, the array it points to will be used for buffering, instead of an automatically allocated buffer. The size
argument specifies the size of the buffer to be used. If input/output is unbuffered, buf and size are ignored.
For a further discussion of buffering, see stdio(3C).
RETURN VALUES
If an illegal value for type is provided, setvbuf() returns a non-zero value. Otherwise, it returns 0.
USAGE
A common source of error is allocating buffer space as an "automatic" variable in a code block, and then failing to close the stream in the
same block.
When using setbuf(), buf should always be sized using BUFSIZ. If the array pointed to by buf is larger than BUFSIZ, a portion of buf will
not be used. If buf is smaller than BUFSIZ, other memory may be unexpectedly overwritten.
Parts of buf will be used for internal bookkeeping of the stream and, therefore, buf will contain less than size bytes when full. It is
recommended that stdio(3C) be used to handle buffer allocation when using setvbuf().
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO fopen(3C), getc(3C), malloc(3C), putc(3C), stdio(3C), attributes(5), standards(5)SunOS 5.10 14 Aug 2002 setbuf(3C)