12-05-2008
Extracting fields from file
I am need to extract a number of values from a file, put have now clue how to do this.
The file looks like this:
# My file
Dest=87;CompatibleSystemSoftwareVersion=2.5300-;
Dest=87;ImageVersion=000061f3;SystemSoftwareVersion=2.5300;CDN=http://my.backup.com/download.txt;CDN_Timeout=30;
I would like to extract the value for SystemSoftwareVersion and CDN into two variables as part of a bash-script so that I can use them further.
Appreciate the help...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am getting a variable as x=2006/01/18
now I have to extract each field from it.
Like x1=2006, x2=01 and x3=18.
Any idea how?
Thanks a lot for help.
Thanks
CSaha (6 Replies)
Discussion started by: csaha
6 Replies
2. UNIX for Dummies Questions & Answers
Dear friends,
I'm a novice Unix user and I'm trying to learn the ropes. I have a big task I have to accomplish and I'm convinced Unix can get the job done, I just haven't figured out how. I recently posted on the topic of cutting text between unique text patterns and somebody helped me a great... (24 Replies)
Discussion started by: spindoctor
24 Replies
3. Shell Programming and Scripting
Hi,
i have a line with several fields (indefinite number of - count varies) separated by colon.
Now, i need to pick each field (except the first one) and have it assigned to variable within a loop. In other words, in the first iteration of the loop, the variable must be assigned with 2nd... (2 Replies)
Discussion started by: prvnrk
2 Replies
4. Shell Programming and Scripting
Greetings,
I would like to extract records from a fixed width text file that have unique field elements.
Data is structured like this:
John A Smith NY
Mary C Jones WA
Adam J Clark PA
Mary Jones WA
Fieldname / start-end position
Firstname 1-10... (8 Replies)
Discussion started by: sitney
8 Replies
5. Shell Programming and Scripting
I need some assistance, I am writing a script in bash.
I want to do two things:
1/. I want to replace the LF at the end of the RFH Ø ¸MQSTR ¸ so I can process the file record by record using a while loop.
2/. I want to extract two fields from each record, they are identified with... (1 Reply)
Discussion started by: gugs
1 Replies
6. Shell Programming and Scripting
Hi,
I have multiple files in a directory all I am trying to do is to read the files in the directory and extract data from 2nd field till 10th field and put it in a new files. The files are pipe delimited. The new file will have the same name as the old file but the prefix of PRE_oldfilename.
... (1 Reply)
Discussion started by: simi28
1 Replies
7. Shell Programming and Scripting
Hi,
I need to extract last character of the field retrieved from the database using select command.
eg:
select event,text from event_data;
o/p: Event1,text1
But I need to extract only '1' from the fields...similarly '2' from Event2,text2 and '3' from Event3,text3 etc., and need to pass... (6 Replies)
Discussion started by: Rajesh Putnala
6 Replies
8. Shell Programming and Scripting
I have an input file with contents like:
203969 OrdAcctCycChg USAGE_DAEMON1
203970 OrdAcctCycChg USAGE_DAEMON2
203971 OrdAcctCycChg USAGE_DAEMON3
203972 OrdAcctCycChg USAGE_DAEMON4
I need to extract variables in first column... (51 Replies)
Discussion started by: Rajesh Putnala
51 Replies
9. Shell Programming and Scripting
I have one file A.txt which is comma separated and I want to extract first 4 field's in a file and also I want to add one more column in output
A.txt in output for all records. A.txt should not be hard coded since I do not filename it may be any file. (1 Reply)
Discussion started by: vamsi.valiveti
1 Replies
10. UNIX for Beginners Questions & Answers
Hello All,
I have a requirement to split the input.xml file different files and i have tried using earlier examples(where i have posted in the forum), but still no luck
Here is my input.xml
<jms-system-resource>
<name>UMSJMSSystemResource</name>
... (4 Replies)
Discussion started by: Siv51427882
4 Replies
LEARN ABOUT OSF1
rapi_session
rapi_session(3) Library Functions Manual rapi_session(3)
NAME
rapi_session - Create an Resource ReSerVation Protocol (RSVP) API session
LIBRARY
RAPI Library (librsvp.so, librsvp.a)
SYNOPSIS
#include <rapi.h>
rapi_sid_t rapi_session( rapi_addr_t *Dest, int Protid, unsigned int flags, rapi_event_return_t *Event_rtn, void
*Event_arg, int *errnop);
PARAMETERS
Points to a rapi_addr_t structure that contains the destination IP address (IPv4 or IPv6) and port number to which data is sent. The Dest
and Protid parameters together define an RSVP session. If the Protid specifies the UDP or TCP transport, the port corresponds to the
appropriate transport port number. See RSVP(7) for the format of the rapi_addr_t structure. Specifies the IP protocol identifier for the
session. If you do not set this parameter, the API defaults to the UDP protocol (value 17). Specifies one of the following flags: If this
flag is set, this indicates that IntServ formats are used on upcalls; otherwise, Simplified formats are used. See RSVP(7) for a descrip-
tion of RAPI objects and formats. Points to an upcall routine that is invoked to notify the application of RSVP errors and state change
events. Pending events cause the invocation of the upcall function. If no such upcall routine exists, set the parameter to NULL. See
rapi_event_rtn_t(3) for more information. Points to an argument to be passed to the upcall routine when it is invoked. This is an
optional parameter. Points to an integer into which a RSVP API (RAPI) error code is returned.
DESCRIPTION
The rapi_session() routine creates an RSVP API session.
If the call to rapi_session() succeeds, the application might receive upcalls of type RAPI_PATH_EVENT for the API session.
NOTES
An application can have multiple API sessions registered for the same RSVP session or different RSVP sessions at the same time. Each API
session can have only one sender associated with it. Therefore, in order to announce multiple senders for a given RSVP session, an appli-
cation must announce each sender in a separate API session.
If two API sessions for the same RSVP session are receiving data, they are assumed to have joined the same multicast group and will receive
the same data packets. At present, if two or more such sessions issue calls to the rapi_reserve() routine, their reservation parameters
must agree or unpredictable results occur; reservation parameter conflicts are not checked.
RETURN VALUES
Upon successful completion, the rapi_session() routine returns a non-zero session handle for use in subsequent calls related to this RSVP
API session.
Upon failure, it returns a session handle with a value of zero (RAPI_NULL_SID) and sets an integer variable pointed to by errnop to an RAPI
error code.
RELATED INFORMATION
Functions: rapi_dispatch(3), rapi_event_rtn_t(3), rapi_getfd(3), rapi_release(3), rapi_reserve(3), rapi_sender(3), rapi_strerror(3),
rapi_version(3).
Network: RSVP(7). delim off
rapi_session(3)