Sponsored Content
Top Forums Shell Programming and Scripting Need a word which just comes next to after grep of a specific word Post 302879864 by Vishal_dba on Monday 16th of December 2013 08:49:53 AM
Old 12-16-2013
Thanks Akshay!


However,this is not working in aix machine

Code:
 pref=$(grep -Po -m1 '(?<=PREF:).*(?=AVAIL:)' /tmp/test.out)
grep: illegal option -- P
grep: illegal option -- o
grep: illegal option -- m
grep: illegal option -- 1


Please help


Best regards,
Vishal
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep a word from a specific line

for example: searches only for single word for single word this is line three match=$(grep -n -e "single" data.txt) this command will stored "..... single ...... single" into search. how can i grep the single word just from line 2 only?? (3 Replies)
Discussion started by: blurboy
3 Replies

2. UNIX for Dummies Questions & Answers

how to grep for a word and display only the word

Hi, When we "grep" for a word in a file, it returns the lines containing the word that we searched for. Is there a way to display only the words and not the entire line containing them. Thanks Ananth (6 Replies)
Discussion started by: ananthmm
6 Replies

3. Shell Programming and Scripting

Grep out specific word and only that word

ok, so this is proving to be kind of difficult even though it should not be. say for instance I want to grep out ONLY the word fkafal from the below output, how do I do it? echo ajfjf fjfjf iafjga fkafal foeref afoafahfia | grep -w "fkafal" If i run the above command, i get back all the... (4 Replies)
Discussion started by: SkySmart
4 Replies

4. Shell Programming and Scripting

grep part of word or Another word from a string

Hi all, FileOne family balance >>>>> 0 0 0 0 java.io.FileNotFoundException: Settings.xml (No such file or directory) at java.io.FileInputStream.open(Native Method) .. .... ..... ..... java.lang.NullPointerException ... ..... ...... Stacktrace: at... (2 Replies)
Discussion started by: linuxadmin
2 Replies

5. UNIX for Dummies Questions & Answers

How to print line starts with specific word and contains specific word using sed?

Hi, I have gone through may posts and dint find exact solution for my requirement. I have file which consists below data and same file have lot of other data. <MAPPING DESCRIPTION ='' ISVALID ='YES' NAME='m_TASK_UPDATE' OBJECTVERSION ='1'> <MAPPING DESCRIPTION ='' ISVALID ='NO'... (11 Replies)
Discussion started by: tmalik79
11 Replies

6. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

7. Shell Programming and Scripting

Fetch entries in front of specific word till next word

Hi all I have following file which I have to edit for research purpose file:///tmp/moz-screenshot.png body, div, table, thead, tbody, tfoot, tr, th, td, p { font-family: &quot;Liberation Sans&quot;; font-size: x-small; } Drug: KRP-104 QD Drug: Placebo Drug: Metformin|Drug:... (15 Replies)
Discussion started by: Priyanka Chopra
15 Replies

8. Shell Programming and Scripting

Search for a specific word and print only the word from the input file

Hi, I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file. Ex: $ cat "sample.log" I am searching for a word which is present in this file We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies

9. Shell Programming and Scripting

Grep for a word or word with underscore

I have a file "test" with following contents: cat test abc abcd_efg abc_abc I want to only grep for abc or abc_ without getting other results, how do I achieve this? If I use grep -w abc test option I get only abc and not abc_. If I use egrep "abc|abc_" test its still printing... (3 Replies)
Discussion started by: ctrld
3 Replies

10. UNIX for Beginners Questions & Answers

Grep or awk a unique and specific word across many fields

Hi there, I have data with similar structure as this: CHR START-SNP END-SNP REF ALT PATIENT1 PATIENT2 PATIENT3 PATIENT4 chr1 69511 69511 A G homo hetero homo hetero chr2 69513 69513 T C . hetero homo hetero chr3 69814 69814 G C . . homo homo chr4 69815 69815 C A hetero . . hetero is... (10 Replies)
Discussion started by: daashti
10 Replies
ExperimentFile(3)						  Staden Package						 ExperimentFile(3)

NAME
exp_read_info, exp_fread_info, exp_create_info, exp_destroy_info, exp_create_range, exp_extract_range, exp_get_feature_index, exp_get_int, exp_get_rng, exp_get_str, exp_put_int, exp_put_rng, exp_put_str, exp_print_line, exp_print_seq, exp_print_file, opos2str, str2opos, conf2str, str2conf - Manipulations of the Experiment File format SYNOPSIS
#include <expFileIO.h> Exp_info *exp_read_info( char *file); Exp_info *exp_fread_info( FILE *fp); Exp_info *exp_create_info(); void exp_destroy_info( Exp_info *e); char *exp_create_range( char *str, int start, int end); int exp_extract_range( char *str, int *start, int *end); int exp_get_feature_index( char *e); int exp_get_int( Exp_info *e, int id, int *val); int exp_get_rng( Exp_info *e, int id, int *from, int *to); int exp_get_str( Exp_info *e, int id, char *s, f_implicit s_l); int exp_put_int( Exp_info *e, int id, int *val); int exp_put_rng( Exp_info *e, int id, int *from, int *to); int exp_put_str( Exp_info *e, int id, char *s, f_implicit s_l); int exp_print_line( FILE *fp, Exp_info *e, int eflt, int i); int exp_print_seq( FILE *fp, Exp_info *e, int eflt, int i); void exp_print_file( FILE *fp, Exp_info *e); char *opos2str( int2 *opos, int len, char *buf); int str2opos( int2 *opos, char *buf); char *conf2str( int1 *conf, int len, char *buf); int str2conf( int1 *conf, char *buf); DESCRIPTION
These functions manipulate Experiment Files. They include functions for reading, writing, and editing the files. The principle structure used by the routines is the Exp_info structure. This is as follows. #define MAXIMUM_EFLT_LENGTH 4 #define MAXIMUM_EFLTS 48 #define EXP_FILE_LINE_LENGTH 128 typedef Array Exp_entries; typedef struct { Array entries[MAXIMUM_EFLTS]; /* array of array of entries */ int Nentries[MAXIMUM_EFLTS]; /* array of number of entries */ FILE *fp; } Exp_info; #define NULL_Exp_info ( (Exp_info *) NULL ) For the purposes of simple and efficient coding, each line on an experiment file must be smaller than the defined EXP_FILE_LINE_LENGTH, which is 128 characters. Many functions take an experiment file line type identifier as an argument. These functions are listed in the prototypes as taking int id. Here id should be specified using one of the macros defining in the header file. They take the form of EFLT_XX where XX is the line type. For instance, the ID line type identifier should be written as EFLT_ID. The C functions available follow. Some FORTRAN interfaces are also available, but these are not documented. See the include file for their prototypes. exp_read_info and exp_fread_info read an experiment file into an allocated Exp_info structure. If successful, the structure pointer is return. Otherwise the null pointer is returned. exp_create_info allocates and initialises a new, blank, Exp_info structure. If successful, the structure pointer is return. Otherwise the null pointer is returned. exp_destroy_info deallocates an Exp_info structure. exp_create_range creates a string using the experiment file range format of "start..stop". This format is used by the AQ, ON, TG and TC line types. The buffer specified should be large enough to hold the string. The function returns the str pointer supplied as an argument. exp_extract_range extracts the start and end values from the string representation of a range; "start..stop". The values are stored in the integer pointers sent as arguments. If successful, the function returns 0. Otherwise -1 is returned. exp_get_feature_index converts from a string representation of an experiment file line type to the integer value. For example, exp_get_fea- ture_index("SQ") returns the integer 22, which is the same as the EFLT_SQ definition. exp_get_int obtains the integer value held in a specific line type. The value is stored in the integer pointer val. If successful, the function returns 0. Otherwise 1 is returned. exp_get_rng obtains the range values held in a specific line type. The values are stored in the integer pointers from and to. If success- ful, the function returns 0. Otherwise 1 is returned. exp_get_str obtains the string value held in a specific line type. The value is stored in the string s. At most s_l characters are copied. If successful, the function returns 0. Otherwise 1 is returned. exp_put_int writes the integer pointed to by val to the specified line type. If successful, the function returns 0. Otherwise 1 is returned. exp_put_rng writes the range pointed to by from and to to the specified line type. If successful, the function returns 0. Otherwise 1 is returned. exp_put_str writes the string s of length s_l to the specified line type. If successful, the function returns 0. Otherwise 1 is returned. exp_print_line outputs all entries of the specified type to the specified file pointer. exp_print_seq exp_print_file outputs all entries of all line types to the specified file pointer. opos2str converts an array of original positions held in opos with len elements to a string suitable for use in the ON line type. The buf should be large enough to hold the string, which in the worst case will be 4 * sequence length. Returns buf. str2opos converts the experiment file original position string held in buf to an array of original positions to be stored in opos. opos must be large enough to hold the data, hence it should be of the same length as the sequence. Returns the number of elements written to the opos array. conf2str converts an array of confidence values helf in confR with len elements to a string suitable for use in the AV line type. The buf should be large enough to hold the string, which in the worst case will be 4 * sequence length. Returns buf. str2conf convers the experiment file confidence values string held in buf to an array of confidence values to be stored in conf. conf must be large enough to hold the data, hence it should be of the same length as the sequence. Returns the number of elements written to the conf array. SEE ALSO
ExperimentFile(4) ExperimentFile(3)
All times are GMT -4. The time now is 05:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy