Sponsored Content
Top Forums Shell Programming and Scripting parsing a portion of Data from a text file Post 302457360 by walid2mi on Tuesday 28th of September 2010 12:15:15 AM
Old 09-28-2010
Code:
awk '/fasta$/{split($NF,m,".");printf m[1]}/SCORE/{printf " %s\n",$3}'  file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing the data in a file

Hi, I have file (FILE.tmp) having contents, FILE.tmp ======== filename=menudata records=0000000000037 ldbname=pinsys timestamp=2005/05/14-18:32:33 I want to parse it bring a new file which will look like, filename records ldbname timestamp... (2 Replies)
Discussion started by: Omkumar
2 Replies

2. Shell Programming and Scripting

Separate a portion of text file into another file

Hi, I have my input as follows : I have given two entries- From system Mon Aug 1 23:52:47 2005 Source !100000006!: Impact !100000005!: High Status ! 7!: New Last Name+!100000001!: First Name+ !100000003!: ... (4 Replies)
Discussion started by: srikanth_ksv
4 Replies

3. UNIX for Dummies Questions & Answers

How to extract a portion of text from a log file

I am using Unix on Mac OS X 10.5.6. I am trying to extract the last entry of a log (text) file. As seen below, each log entry looks like the following (date and time change with each log entry): I want the script to extract everything quoted above, including the "===" dividers. ... (2 Replies)
Discussion started by: atilano
2 Replies

4. Shell Programming and Scripting

How to extract a text portion from a file

Can some one help me with shell script to extract a text block between two known strings. The given input file is as below: Name: abs Some tesxt.... Some tesxt.... Some tesxt.... end of text Name: xyz Some tesxt.... Some tesxt.... Some tesxt.... end of text Name: efg Some... (5 Replies)
Discussion started by: ejazs0
5 Replies

5. Shell Programming and Scripting

Extracting a portion of a data file with identifier

Hi, I do have a TAB delimted text file with the following format. 1 (- identifier of each group. this text is not present in the file only number) 1 3 4 65 56 WERTF 2 3 4 56 56 GHTYHU 3 3 5 64 23 VMFKLG 2 1 3 4 65 56 DGTEYDH 2 3 4 56 56 FJJJCKC 3 3 5 64 23 FNNNCHD 3 1 3 4 65 56 JDHJDH... (9 Replies)
Discussion started by: Lucky Ali
9 Replies

6. Shell Programming and Scripting

Extracting a portion of data from a very large tab delimited text file

Hi All I wanted to know how to effectively delete some columns in a large tab delimited file. I have a file that contains 5 columns and almost 100,000 rows 3456 f g t t 3456 g h 456 f h 4567 f g h z 345 f g 567 h j k lThis is a very large data file and tab delimited. I need... (2 Replies)
Discussion started by: Lucky Ali
2 Replies

7. Shell Programming and Scripting

parsing data and incorporating it into another file

Hi All I have two files: file 1 >AB_1 MLKKPIIIGVTGGSGGGKTSVSRAILDSFPNARIAMIQHDSYYKDQSHMSFEERVKTNYDHPLAFDTDFM IQQLKELLAGRPVDIPIYDYKKHTRSNTTFRQDPQDVIIVEGILVLEDERLRDLMDIKLFVDTDDDIRII RRIKRDMMERGRSLESIIDQYTSVVKPMYHQFIEPSKRYADIVIPEGVSNVVAIDVINSKIASILGEV >AB_2... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

8. Shell Programming and Scripting

Removing a portion of data in a file

Hi, I have a folder that contains many (multiple) files 1.fasta 2.fasta 3.fasta 4.fasta 5.fasta . . 100's of files Each such file have data in the following format for example: vi 1.fasta Code: >AB_1 MLKKPIIIGVTGGSGGGKTSVSRAILDSFPNARIAMIQHDSYYKDQSHMSFEERVKTNYDHPLAFDTDFM (6 Replies)
Discussion started by: Lucky Ali
6 Replies

9. Shell Programming and Scripting

Parsing chunks of text and finding data

Hi, I need a script that parses and greps data out of a textfile. I have a text file that has this structure: File1 host1.localdomain text random text Found errors this text is random (41123) --- random random at.5165 ---- random random at.5165 ---- random random at.5165 ----... (2 Replies)
Discussion started by: erick_tuk
2 Replies

10. Shell Programming and Scripting

Parsing file data

Hey Guys, I'm a novice at shell scripts and i need some help parsing file data. Basically, I want to write a script that retrieves URLs. Here is what I have so far. #!/bin/bash echo "Please enter start date (format: yyyy-mm-dd):\c" read STARTDATE echo "Please enter end date... (7 Replies)
Discussion started by: silverdust
7 Replies
XmParseMapping(library call)											      XmParseMapping(library call)

NAME
XmParseMapping -- Data type for a compound string parse mapping SYNOPSIS
#include <Xm/Xm.h> DESCRIPTION
XmParseMapping is an opaque data type for a parse mapping used by XmStringParseText to create a compound string. A parse mapping contains a pattern to be matched in text being parsed to create a compound string. It also contains a compound string, or a function to be invoked to provide a compound string, to be included in the compound string being created whenever the pattern is matched. An application uses a resource-style interface to specify components for an XmParseMapping. XmParseMappingCreate creates a parse mapping, using a resource-style argument list. XmParseMappingGetValues and XmParseMappingSetValues retrieve and set the components of a parse map- ping. XmParseMappingFree recovers memory used by a parse mapping. XmParseTable is an array of XmParseMapping objects. The XmNinvokeParseProc resource is a function of type XmParseProc, which is defined as follows: XmIncludeStatus (*XmParseProc) (text_in_out, text_end, type, tag, entry, pattern_length, str_include, call_data) XtPointer *text_in_out; XtPointer text_end; XmTextType type; XmStringTag tag; XmParseMapping entry; int pattern_length; XmString *str_include; XtPointer call_data; A parse procedure provides an escape mechanism for arbitrarily complex parsing. This procedure is invoked when a pattern in the input text is matched with a pattern in a parse mapping whose XmNincludeStatus is XmINVOKE. The input text is a pointer to the first byte of the pattern that was matched to trigger the call to the parse procedure. The parse proce- dure consumes as many bytes of the input string as it needs and sets the input text pointer to the following byte. It returns a compound string to be included in the compound string being constructed, and it also returns an XmIncludeStatus indicating how the returned compound string should be handled. If the parse procedure does not set the input text pointer ahead by at least one byte, the parsing routine con- tinues trying to match the input text with the patterns in the remaining parse mappings in the parse table. Otherwise, the parsing routine begins with the new input text pointer and tries to match the input text with patterns in the parse mappings starting at the beginning of the parse table. text_in_out Specifies the text being parsed. The value is a pointer to the first byte of text matching the pattern that triggered the call to the parse procedure. When the parse procedure returns, this argument is set to the position in the text where parsing should resume--that is, to the byte following the last character parsed by the parse procedure. text_end Specifies a pointer to the end of the text_in_out string. If text_end is NULL, the string is scanned until a NULL character is found. Otherwise, the string is scanned up to but not including the character whose address is text_end. type Specifies the type of text and the tag type. If a locale tag should be created, type has a value of either XmMULTIBYTE_TEXT or XmWIDECHAR_TEXT. If a charset should be created, type has a value of XmCHARSET_TEXT. tag Specifies the tag to be used in creating the result. The type of string tag created (charset or locale) depends on the text type and the passed in tag value. If the tag value is NULL and if type indicates that a charset string tag should be created, the string tag has the value that is the result of mapping XmSTRING_DEFAULT_CHARSET. If type indicates a locale string tag, the string tag has the value _MOTIF_DEFAULT_LOCALE. entry Specifies the parse mapping that triggered the call to the parse procedure. pattern_length Specifies the number of bytes in the input text, following text_in_out, that constitute the matched pattern. str_include Specifies a pointer to a compound string. The parse procedure creates a compound string to be included in the compound string being constructed. The parse procedure then returns the compound string in this argument. call_data Specifies data passed by the application to the parsing routine. The parse procedure returns an XmIncludeStatus indicating how str_include is to be included in the compound string being constructed. Fol- lowing are the possible values: XmINSERT Concatenate the result to the compound string being constructed and continue parsing. XmTERMINATE Concatenate the result to the compound string being constructed and terminate parsing. New Resources The following table defines a set of resources used by the programmer to specify data. The codes in the access column indicate if the given resource can be set at creation time (C), set by using XmParseMappingSetValues (S), retrieved by using XmParseMappingGetValues (G), or is not applicable (N/A). +-----------------------------------------------------------------------+ | | XmParseMapping Resource Set | | |Name | Class | Type | Default | Access | +-------------------+-------+-----------------+----------------+--------+ |XmNclientData | | XtPointer | NULL | CSG | +-------------------+-------+-----------------+----------------+--------+ |XmNincludeStatus | | XmIncludeStatus | XmINSERT | CSG | +-------------------+-------+-----------------+----------------+--------+ |XmNinvokeParseProc | | XmParseProc | NULL | CSG | +-------------------+-------+-----------------+----------------+--------+ |XmNpattern | | XtPointer | NULL | CSG | +-------------------+-------+-----------------+----------------+--------+ |XmNpatternType | | XmTextType | XmCHARSET_TEXT | CSG | +-------------------+-------+-----------------+----------------+--------+ |XmNsubstitute | | XmString | NULL | CSG | +-------------------+-------+-----------------+----------------+--------+ +-------------------+-------+-----------------+----------------+--------+ XmNclientData Specifies data to be used by the parse procedure. XmNincludeStatus Specifies how the result of the mapping is to be included in the compound string being constructed. Unless the value is XmIN- VOKE, the result of the mapping is the value of XmNsubstitute. Following are the possible values for XmNincludeStatus: XmINSERT Concatenate the result to the compound string being constructed and continue parsing. XmINVOKE Invoke the XmNinvokeParseProc on the text being parsed and use the returned compound string instead of XmNsubstitute as the result to be inserted into the compound string being constructed. The include status returned by the parse proce- dure (XmINSERT or XmTERMINATE) determines how the returned compound string is included. XmTERMINATE Concatenate the result to the compound string being constructed and terminate parsing. XmNinvokeParseProc Specifies the parse procedure to be invoked when XmNincludeStatus is XmINVOKE. XmNpattern Specifies a pattern to be matched in the text being parsed. This is a maximum of one character. XmNpatternType Specifies the type of the pattern that is the value of XmNpattern. Following are the possible values: o XmCHARSET_TEXT o XmMULTIBYTE_TEXT o XmWIDECHAR_TEXT XmNsubstitute Specifies the compound string to be included in the compound string being constructed when XmNincludeStatus is XmINSERT or XmTER- MINATE. RELATED
XmParseMappingCreate(3), XmParseMappingFree(3), XmParseMappingGetValues(3), XmParseMappingSetValues(3), XmParseTable(3), and XmString(3). XmParseMapping(library call)
All times are GMT -4. The time now is 12:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy