Sponsored Content
Top Forums Shell Programming and Scripting Contents and details extract problem asking... Post 302406857 by patrick87 on Wednesday 24th of March 2010 04:38:22 AM
Old 03-24-2010
Contents and details extract problem asking...

Input:
Code:
length    align    type    5453    8666    +
length    align    portion    5453    8666    +
length    align    range  5453    5616    +
length    align    name    5453    6121    +
length    align    age     5617    6121    +
length    align    name    7214    7404    +
length    align    age     7214    7404    +
length    align    name    8378    8666    +
length    align    age     8378    8416    +
length    align    average         8417    8666    +

length    align    type    33357   37495   -
length    align    portion    33357   37495   -
length    align    range  37341   37495   -
length    align    name    37065   37495   -
length    align    age     37065   37340   -
.
.

Output:
Code:
length    5453    6121    
length    7214    7404    
length    8378    8666    

length    37495   37065
.
.

All the portion is separated by a new line or "type". Under the "type", I only need to focus on the data with "name" at the column3. For those that "name" at the column3 and column6 is marked as "+", the data of column4 and column5 can be maintained. While those that "name" at the column3 and column6 is marked as "-", the data of column4 and column5 should be reversed. It seems like awk able to archive these goal.
Thanks for any advice.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

i want to extract details for particular file

Hi i have following file uuid ( RO) : 62701790-60da-dd9a-669d-a563aac1c435 host-uuid ( RO): 5f3f668d-a7c7-4e5f-a4a6-6e90fafb50ed sr-uuid ( RO): 62103d07-e0aa-acf3-2d9f-414ad3377bd0 device-config (MRO): location: /dev/xapi/block ... (6 Replies)
Discussion started by: bp_vardhaman
6 Replies

2. Shell Programming and Scripting

Shell script or command help to extract specific contents from a long list of content

Hi, I got a long list of contents: >sequence_1 ASSSSSSSSSSSDDDDDDDDDDDCCCCCCC ASDSFDFFDFDFFWERERERERFSDFESFSFD >sequence_2 ASDFDFDFFDDFFDFDSFDSFDFSDFSDFDSFASDSADSADASD ASDFFDFDFASFASFASFAFSFFSDASFASFASFAFS >sequence_3 VEDFGSDGSDGSDGSDGSDGSDGSDG dDFSDFSDFSDFSDFSDFSDFSDFSDF... (2 Replies)
Discussion started by: patrick87
2 Replies

3. UNIX for Dummies Questions & Answers

How to extract contents of ONLY one directory from ZIP folder.

I have a ZIP folder ( folder.zip or folder.jar ) which contains , lets say 3 directories under it ( directory1, directory2, directory3). How can i unzip the contents of directory2 ONLY ? I do not have to unzip the complete folder. TIA. (2 Replies)
Discussion started by: Sheel
2 Replies

4. Shell Programming and Scripting

Extract details from XML file

Hi , I have one xml file contains more than 60 lines. I need to extract some details from the file and store it in new file.Not the whole file Please find the xml file below: <?xml version="1.0" encoding="UTF-8"?> <DeploymentDescriptors xmlns="http://www.tibco.com/xmlns/dd"> ... (6 Replies)
Discussion started by: ckchelladurai
6 Replies

5. Shell Programming and Scripting

Extract contents of tar ball without extracting files

Hi, I'm using a tar command tar -xOvf /home/mytar.tar My intention is to extract data in files which are inside various directories, without extracting files to the disk. Is this the best way to achieve it? Thanks, Chetan (3 Replies)
Discussion started by: chetan.c
3 Replies

6. Shell Programming and Scripting

Formatting Report and Reading data and fetching the details from contents file

Data I was trying to write shell script which will be return the output in the below format First i was trying to do these using sed. sed -n '/.ksh/p' mainksh.ksh sed -e 's/*\(.*\)/\1/g' mainksh.ksh $RUN_DIR, $SUB_DIR and the variables which will be defined in the profile file. when i am... (0 Replies)
Discussion started by: rameshds
0 Replies

7. UNIX for Dummies Questions & Answers

Extract specific contents from each line

Hi all, Happy new year! Here I have a problem with extract specific information from each line in unix: My file is the dbSNP flat file, take two SNPs for examples: REFSNP-DOCSUM-SET (FULL-DUMP) CREATED ON: 2012-06-08 10:50 rs782 | human | 9606 | snp | genotype=NO |... (6 Replies)
Discussion started by: luoruicd
6 Replies

8. Shell Programming and Scripting

Extract sentence and its details from a text file based on another file of sentences

Hi I have two text files. The first file is TEXTFILEONE.txt as given below: <Text Text_ID="10155645315851111_10155645333076543" From="460350337461111" Created="2011-03-16T17:05:37+0000" use_count="123">This is the first text</Text> <Text Text_ID="10155645315851111_10155645317023456"... (7 Replies)
Discussion started by: my_Perl
7 Replies

9. Shell Programming and Scripting

Extract both contents from a html file and do printing

Hi there, Print IP Address: grep 'HostID :' 10.244.9.124\ nessus.html | awk -F '<br>' '{print $12}' | tr -s ' ' | awk -F ':' '{print "<tr><td>" $2 "</td><td>"}' Print Respective Ports: grep 'classsubsection\|./tcp\|./udp' 10.244.9.124\ nessus.html | grep -v 'h2.classsubsection... (3 Replies)
Discussion started by: alvinoo
3 Replies

10. Shell Programming and Scripting

Need to extract jil file details in a excelsheet

I am very new to shell scripting. I have a autosys jil file that looks like :-- /* ------------- JOB1 ------------------ */ insert_job: JOB1 job_type: b owner: cm@pelonmuck permission: gx,ge,wx,we,mx,me date_conditions: 1 days_of_week: mo,tu,we,th,fr,su start_time: "18:30"... (9 Replies)
Discussion started by: newbie_shell
9 Replies
inet6_opt_init(3N)														inet6_opt_init(3N)

NAME
inet6_opt_init(), inet6_opt_append(), inet6_opt_find(), inet6_opt_finish(), inet6_opt_get_val(), inet6_opt_next(), inet6_opt_set_val() - IPv6 Hop-by-Hop and Destination options manipulation functions. SYNOPSIS
DESCRIPTION
These functions can be used by applications to build and parse the IPv6 Hop-by-Hop and Destination options header. The Hop-by-Hop option header is used to carry optional information that must be examined by every node along a packet's delivery path and the Destination option header is used to carry optional information that needs to be examined only by a packet's destination node(s). This function returns the number of bytes needed for the empty extension header without any options. If extbuf is not NULL, it also initializes the extension header to have the correct length field. If the extlen value is not a positive multiple of 8, the function fails and returns -1. This function returns the updated total length required to add an option with length len and alignment align. If extbuf is not NULL, then in addition to returning the length, this function also inserts any needed pad option, initializes the option (sets the type and length fields), and returns a pointer to the location for the option content in databufp. If the option specified by type does not fit in the extension header buf- fer then the function returns -1. The third parameter offset should be the length returned by or by a previous The parameter type is the 8-bit option type and it must be a value from 2 to 255, inclusive. 0 and 1 are reserved for the Pad1 and PadN options, respectively. The parameter len is the length of the option data excluding the option type and option length fields. It must have a value between 0 and 255, inclusive, and it specifies the length of the option data that follows the option header. The align parameter must have a value of 1, 2, 4, or 8. The align value can not exceed the value of len. If the len parameter is 0, the align parameter is ignored. Once has been called, the application can use databuf directly, or use to specify (set) the contents of the option. This function returns the updated total length including the final padding of the extension header to make the header a multiple of 8 bytes. If extbuf is not NULL, the function also initializes the option by inserting a Pad1 or PadN option of the proper length. If the nec- essary pad does not fit in the extension header buffer, the function returns -1. The parameter offset should be the length returned by or This function inserts data items of various sizes (1, 2, 4, or 8 bytes) in the data portion of the option. After inserting, the function returns the offset for the next field (offset + vallen) which can be used when composing option content with multiple fields. The parameter val points to the data to be inserted and the parameter offset specifies where in the data portion of the option the value should be inserted. The first byte after the option type and length is accessed by specifying an offset of zero. The parameter databuf should be a pointer returned by This function parses extension header options received by the application and it returns the offset of the next option. The parameters extbuf and extlen specify the extension header. The parameter offset is either zero (for the first option) or the length returned by a previous call to or offset specifies the posi- tion where to continue scanning the extension buffer. The next option is returned by updating the parameters databufp, typep, and lenp. This function returns the updated "previous" length computed by advancing past the option that was returned. This returned "previous" length can then be passed to subsequent calls to This function does not return any Pad1 or PadN options. When there are no more options or if the option extension header is mal- formed, the return value is -1. This function is similar to the function but this function lets the caller specify the option type to be searched for instead of always returning the next option in the extension header. If an option of the specified type is located, the function returns the updated "previous" total length. This "previous" total length is computed by advancing past the option that was returned and past any options that did not match the type. This returned previous length can then be passed to subsequent calls to for finding the next occurrence of the same option type. If an option of the specified type is not located or the option extension header is malformed, the return value is -1. This function extracts data items of various sizes (1, 2, 4, or 8 bytes) in the data portion of the option. The function returns the offset for the next field (offset + vallen) which can be used when extracting option content with multiple fields. The first parameter databuf should be a pointer returned by or containing the data portion of the option. offset parameter specifies from where in the data portion of the option the value should be extracted. The first byte after the option type and length is accessed by specifying an offset of zero. val points to the destination for the extracted data. Notes To use these functions, the application must be compiled with: To receive Hop-by-Hop options, the application must enable the socket option: To send a Hop-by-Hop options header, the application specifies the header either as ancillary data in a call to or using The application can remove any sticky Hop-by-Hop extension header by calling for with a zero option length. To receive Destination options appearing after a Routing header (or in a packet without a Routing header), the application must enable the socket option: To receive Destination options appearing before a Routing header, the application must enable the socket option: To send a Destination options header, the application specifies it either as ancillary data in a call to or using The application can remove any sticky Destination extension header by calling for with a zero option length. RETURN VALUE
and return -1 on an error. EXAMPLES
gives a comprehensive example in Appendix C. SEE ALSO
ip6(7P), xopen_networking(7). inet6_opt_init(3N)
All times are GMT -4. The time now is 06:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy