Sponsored Content
Top Forums Shell Programming and Scripting searching for info in paragraph Post 302250529 by daveisme on Thursday 23rd of October 2008 03:19:25 PM
Old 10-23-2008
searching for info in paragraph

I need to capture data from a paragraph list and am not sure how to get my data. I created a file from a tapeutil command which has many entries 1 entry is posted below
;
Slot Address 1025
Slot State ..................... Normal
ASC/ASCQ ....................... 0000
Media Present .................. Yes
Robot Access Allowed ........... Yes
Source Element Address Valid ... No
Media Inverted ................. No
Volume Tag ..................... 00001

I want to search for the volume tag # 00001 but I want to capture the Slot Address # 1025. Basically I want to search a file for tape 0001 and get a return of Slot Address 1025.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bold the paragraph

Hi, I have a file with multiple paragraph. I want to look for some word and make that paragraph bold. How can I do that? Thanks, Karthik (3 Replies)
Discussion started by: caprikar
3 Replies

2. Shell Programming and Scripting

extracting last paragraph from a text

Hi All, I want to extract last paragraph from a text for example aaaaa sadafsa sdfdsaf asfdsad asfdsfad asfdfsafd adfssas asdfsafdsa asfdasdfa sadfasdsaf i need the last paragraph how to do it using linux commands (1 Reply)
Discussion started by: uvrakesh
1 Replies

3. Shell Programming and Scripting

help, using awk to get paragraph

Hi, I'm trying to find pattern in log file. I'm using awk to search the pattern and print the paragraph. And it's not working well like I want. The file actually is TCAP message, it has format like this : ... ... ... ***************************************** INCOMING TCAP MESSAGE At... (6 Replies)
Discussion started by: kunimi
6 Replies

4. Linux

Extract a paragraph

Hi , Unix.com has been life saver for me I admit :) I am trying to extract a paragraph based on matching pattern "CREATE TABLE " from a ddl file . The paragraphs are seperated by blank line . Input file is #cat zip.20080604.sql1 CONNECT TO TST103 SET SESSION_USER OPSDM002 ... (2 Replies)
Discussion started by: capri_drm
2 Replies

5. UNIX for Dummies Questions & Answers

Split a paragraph

Hi, Consider the following paragraph. This is line1. This is line2, This is last line. I need the output as 4:This is last line. i.e The line after the blank line should be displayed along with line number. I am a unix begineer.Any one please help me to solve this problem (3 Replies)
Discussion started by: Sekar1
3 Replies

6. Shell Programming and Scripting

Pattern in a paragraph

Hi, I have read similar questions and I was not able to get a solution, so please help :) I have two files: 1-Pattern file contains list of patterns pattern1 pattern2 pattern3 pattern4 .... pattern# 2-input file in the format >hdhfshsdfjhpattern1xmbxmbxnmv... (4 Replies)
Discussion started by: tbakheet
4 Replies

7. UNIX for Dummies Questions & Answers

Output text from 1st paragraph in file w/ a specific string through last paragraph of file w/ string

Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string. Previously, I was outputting just each paragraph with that search string with: cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)
Discussion started by: carpenn
2 Replies

8. Shell Programming and Scripting

How to grep paragraph?

Hi, I have A file like this: >Contig1 AAAAAAATTTTTTCCCAATATATGAT ATATATAEATATATAT >Contig2 AAAAAAATTTTTTCCCAATATATGAT ATATATAEAATTTTTAATTTTTTCCCA ATCCCAAATATATAT >Contig3 AAAAAAATTTTTTCCCAATATATGAT ATATATAEAATTTTTAATTTTTTCCCA ATCCCAAATAAATTTTTTCCCAATAT ATGATATATATAEAATTTTTAATTTTT... (3 Replies)
Discussion started by: the_simpsons
3 Replies

9. Shell Programming and Scripting

Compare a paragraph

I know this is a challenging, its about comparing a 3 paragraph, from a whois command, i want to print what is the data that is not unique, example below is the admin phone and techphone, the rest is the same.it will print the correct and wrong # whois google.com| sed -n '/Registry Registrant... (3 Replies)
Discussion started by: kenshinhimura
3 Replies

10. UNIX for Dummies Questions & Answers

Extract paragraph that contains a value x<-30

I am using OSX. I have a multi-mol2 file (text file with coordinates and info for several molecules). An example of two molecules in the file is given below for molecule1 and molecule 2. The total file contains >50,000 molecules. I would like to extract out and write to another file only the... (2 Replies)
Discussion started by: Egy
2 Replies
ici::doc::pod3::sdrlist(3)				       ICI library functions					ici::doc::pod3::sdrlist(3)

NAME
sdrlist - Simple Data Recorder list management functions SYNOPSIS
#include "sdr.h" typedef int (*SdrListCompareFn)(Sdr sdr, Address eltData, void *argData); typedef void (*SdrListDeleteFn)(Sdr sdr, Object elt, void *argument); [see description for available functions] DESCRIPTION
The SDR list management functions manage doubly-linked lists in managed SDR heap space. The functions manage two kinds of objects: lists and list elements. A list knows how many elements it contains and what its start and end elements are. An element knows what list it belongs to and the elements before and after it in the list. An element also knows its content, which is normally the SDR Address of some object in the SDR heap. A list may be sorted, which speeds the process of searching for a particular element. Object sdr_list_create(Sdr sdr) Creates a new list object in the SDR; the new list object initially contains no list elements. Returns the address of the new list, or zero on any error. void sdr_list_destroy(Sdr sdr, Object list, SdrListDeleteFn fn, void *arg) Destroys a list, freeing all elements of list. If fn is non-NULL, that function is called once for each freed element; when called, fn is passed the Address that is the element's data and the argument pointer passed to sdr_list_destroy(). Do not use sdr_free to destroy an SDR list, as this would leave the elements of the list allocated yet unreferenced. int sdr_list_length(Sdr sdr, Object list) Returns the number of elements in the list, or -1 on any error. void sdr_list_user_data_set(Sdr sdr, Object list, Address userData) Sets the "user data" word of list to userData. Note that userData is nominally an Address but can in fact be any value that occupies a single word. It is typically used to point to an SDR object that somehow characterizes the list as a whole, such as a name. Address sdr_list_user_data(Sdr sdr, Object list) Returns the value of the "user data" word of list, or zero on any error. Object sdr_list_insert(Sdr sdr, Object list, Address data, SdrListCompareFn fn, void *dataBuffer) Creates a new list element whose data value is data and inserts that element into the list. If fn is NULL, the new list element is simply appended to the list; otherwise, the new list element is inserted after the last element in the list whose data value is "less than or equal to" the data value of the new element (in dataBuffer) according to the collating sequence established by fn. Returns the address of the newly created element, or zero on any error. Object sdr_list_insert_first(Sdr sdr, Object list, Address data) Object sdr_list_insert_last(Sdr sdr, Object list, Address data) Creates a new element and inserts it at the front/end of the list. This function should not be used to insert a new element into any ordered list; use sdr_list_insert() instead. Returns the address of the newly created list element on success, or zero on any error. Object sdr_list_insert_before(Sdr sdr, Object elt, Address data) Object sdr_list_insert_after(Sdr sdr, Object elt, Address data) Creates a new element and inserts it before/after the specified list element. This function should not be used to insert a new element into any ordered list; use sdr_list_insert() instead. Returns the address of the newly created list element, or zero on any error. void sdr_list_delete(Sdr sdr, Object elt, SdrListDeleteFn fn, void *arg) Delete elt from the list it is in. If fn is non-NULL, that function will be called upon deletion of elt; when called, that function is passed the Address that is the list element's data value and the arg pointer passed to sdr_list_delete(). Object sdr_list_first(Sdr sdr, Object list) Object sdr_list_last(Sdr sdr, Object list) Returns the address of the first/last element of list, or zero on any error. Object sdr_list_next(Sdr sdr, Object elt) Object sdr_list_prev(Sdr sdr, Object elt) Returns the address of the element following/preceding elt in that element's list, or zero on any error. Object sdr_list_search(Sdr sdr, Object elt, int reverse, SdrListCompareFn fn, void *dataBuffer); Search a list for an element whose data matches the data in dataBuffer, starting at the indicated initial list element. If the compare function is non-NULL, the list is assumed to be sorted in the order implied by that function and the function is automatically called once for each element of the list until it returns a value that is greater than or equal to zero (where zero indicates an exact match and a value greater than zero indicates that the list contains no matching element); each time compare is called it is passed the Address that is the element's data value and the dataBuffer value passed to sm_list_search(). If reverse is non-zero, then the list is searched in reverse order (starting at the indicated initial list element) and the search ends when compare returns a value that is less than or equal to zero. If compare is NULL, then the entire list is searched (in either forward or reverse order, as directed) until an element is located whose data value is equal to ((Address) dataBuffer). Returns the address of the matching element if one is found, 0 otherwise. Object sdr_list_list(Sdr sdr, Object elt) Returns the address of the list to which elt belongs, or 0 on any error. Address sdr_list_data(Sdr sdr, Object elt) Returns the Address that is the data value of elt, or 0 on any error. Address sdr_list_data_set(Sdr sdr, Object elt, Address data) Sets the data value for elt to data, replacing the original value. Returns the original data value for elt, or 0 on any error. The original data value for elt may or may not have been the address of an object in heap data space; even if it was, that object was NOT deleted. Warning: changing the data value of an element of an ordered list may ruin the ordering of the list. USAGE
When inserting elements or searching a list, the user may optionally provide a compare function of the form: int user_comp_name(Sdr sdr, Address eltData, void *dataBuffer); When provided, this function is automatically called by the sdrlist function being invoked; when the function is called it is passed the content of a list element (eltData, nominally the Address of an item in the SDR's heap space) and an argument, dataBuffer, which is nominally the address in local memory of some other item in the same format. The user-supplied function normally compares some key values of the two data items and returns 0 if they are equal, an integer less than 0 if eltData's key value is less than that of dataBuffer, and an integer greater than 0 if eltData's key value is greater than that of dataBuffer. These return values will produce a list in ascending order. If the user desires the list to be in descending order, the function must reverse the signs of these return values. When deleting an element or destroying a list, the user may optionally provide a delete function of the form: void user_delete_name(Sdr sdr, Address eltData, void *argData) When provided, this function is automatically called by the sdrlist function being invoked; when the function is called it is passed the content of a list element (eltData, nominally the Address of an item in the SDR's heap space) and an argument, argData, which if non-NULL is normally the address in local memory of a data item providing context for the list element deletion. The user-supplied function performs any application-specific cleanup associated with deleting the element, such as freeing the element's content data item and/or other SDR heap space associated with the element. SEE ALSO
lyst(3), sdr(3), sdrstring(3), sdrtable(3), smlist(3) perl v5.14.2 2012-05-25 ici::doc::pod3::sdrlist(3)
All times are GMT -4. The time now is 11:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy