Sponsored Content
Top Forums Shell Programming and Scripting Need a word which just comes next to after grep of a specific word Post 302879856 by Akshay Hegde on Monday 16th of December 2013 07:59:09 AM
Old 12-16-2013
Quote:
Originally Posted by RavinderSingh13
Thank you Akshay for the great commands. Could you please explain the same please, will be grateful to you.


Thanks,
R. Singh

Code:
grep -Po -m1 '(?<=PREF:).*(?=AVAIL:)'

P---> Interprets as regular perl expression

o---> Printout only what is matched

m 1 --> Max count 1, after match stop reading file

( --> start grouping

?<=PRES: --> positive look behind, but don't match PRES:

) --> end grouping

.* --> anything after positive look behind to negative look behind will be part of match

( --> start grouping

?=AVAIL: --> negative look behind

) --> end grouping

Hope its fine.
This User Gave Thanks to Akshay Hegde For This Post:
 

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
std::moneypunct_byname< _CharT, _Intl >(3cxx)							     std::moneypunct_byname< _CharT, _Intl >(3cxx)

NAME
std::moneypunct_byname< _CharT, _Intl > - SYNOPSIS
Inherits std::moneypunct< _CharT, _Intl >. Public Types enum { _S_minus, _S_zero, _S_end } typedef __moneypunct_cache < _CharT, _Intl > __cache_type" typedef _CharT char_type enum part { none, space, symbol, sign, value } typedef basic_string< _CharT > string_type Public Member Functions moneypunct_byname (const char *__s, size_t __refs=0) string_type curr_symbol () const char_type decimal_point () const int frac_digits () const string grouping () const string_type negative_sign () const string_type positive_sign () const char_type thousands_sep () const pattern pos_format () const pattern neg_format () const Static Public Member Functions static pattern _S_construct_pattern (char __precedes, char __space, char __posn) throw () Static Public Attributes static const char * _S_atoms static const pattern _S_default_pattern static locale::id id static const bool intl Protected Member Functions void _M_initialize_moneypunct (__c_locale __cloc=0, const char *__name=0) template<> void _M_initialize_moneypunct (__c_locale, const char *) template<> void _M_initialize_moneypunct (__c_locale, const char *) template<> void _M_initialize_moneypunct (__c_locale, const char *) template<> void _M_initialize_moneypunct (__c_locale, const char *) virtual string_type do_curr_symbol () const virtual char_type do_decimal_point () const virtual int do_frac_digits () const virtual string do_grouping () const virtual pattern do_neg_format () const virtual string_type do_negative_sign () const virtual pattern do_pos_format () const virtual string_type do_positive_sign () const virtual char_type do_thousands_sep () const Static Protected Member Functions static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw () static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0) static void _S_destroy_c_locale (__c_locale &__cloc) static __c_locale _S_get_c_locale () static const char * _S_get_c_name () throw () static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s) Detailed Description template<typename _CharT, bool _Intl>class std::moneypunct_byname< _CharT, _Intl > class moneypunct_byname [22.2.6.4]. Definition at line 1324 of file locale_facets_nonio.h. Member Function Documentation template<typename _CharT , bool _Intl> string_type std::moneypunct< _CharT, _Intl >::curr_symbol () const [inline], [inherited] Return currency symbol string. This function returns a string_type to use as a currency symbol. It does so by returning returning moneypunct<char_type>::do_curr_symbol(). Returns: string_type representing a currency symbol. Definition at line 1061 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_curr_symbol(). template<typename _CharT , bool _Intl> char_type std::moneypunct< _CharT, _Intl >::decimal_point () const [inline], [inherited] Return decimal point character. This function returns a char_type to use as a decimal point. It does so by returning returning moneypunct<char_type>::do_decimal_point(). Returns: char_type representing a decimal point. Definition at line 1005 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_decimal_point(). template<typename _CharT , bool _Intl> virtual string_type std::moneypunct< _CharT, _Intl >::do_curr_symbol () const [inline], [protected], [virtual], [inherited] Return currency symbol string. This function returns a string_type to use as a currency symbol. This function is a hook for derived classes to change the value returned. See Also: curr_symbol() for details. Returns: string_type representing a currency symbol. Definition at line 1207 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::curr_symbol(). template<typename _CharT , bool _Intl> virtual char_type std::moneypunct< _CharT, _Intl >::do_decimal_point () const [inline], [protected], [virtual], [inherited] Return decimal point character. Returns a char_type to use as a decimal point. This function is a hook for derived classes to change the value returned. Returns: char_type representing a decimal point. Definition at line 1169 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::decimal_point(). template<typename _CharT , bool _Intl> virtual int std::moneypunct< _CharT, _Intl >::do_frac_digits () const [inline], [protected], [virtual], [inherited] Return number of digits in fraction. This function returns the exact number of digits that make up the fractional part of a money amount. This function is a hook for derived classes to change the value returned. See Also: frac_digits() for details. Returns: Number of digits in amount fraction. Definition at line 1247 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::frac_digits(). template<typename _CharT , bool _Intl> virtual string std::moneypunct< _CharT, _Intl >::do_grouping () const [inline], [protected], [virtual], [inherited] Return grouping specification. Returns a string representing groupings for the integer part of a number. This function is a hook for derived classes to change the value returned. See Also: grouping() for details. Returns: String representing grouping specification. Definition at line 1194 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::grouping(). template<typename _CharT , bool _Intl> virtual pattern std::moneypunct< _CharT, _Intl >::do_neg_format () const [inline], [protected], [virtual], [inherited] Return pattern for money values. This function returns a pattern describing the formatting of a negative valued money amount. This function is a hook for derived classes to change the value returned. See Also: neg_format() for details. Returns: Pattern for money values. Definition at line 1275 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::neg_format(). template<typename _CharT , bool _Intl> virtual string_type std::moneypunct< _CharT, _Intl >::do_negative_sign () const [inline], [protected], [virtual], [inherited] Return negative sign string. This function returns a string_type to use as a sign for negative amounts. This function is a hook for derived classes to change the value returned. See Also: negative_sign() for details. Returns: string_type representing a negative sign. Definition at line 1233 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::negative_sign(). template<typename _CharT , bool _Intl> virtual pattern std::moneypunct< _CharT, _Intl >::do_pos_format () const [inline], [protected], [virtual], [inherited] Return pattern for money values. This function returns a pattern describing the formatting of a positive valued money amount. This function is a hook for derived classes to change the value returned. See Also: pos_format() for details. Returns: Pattern for money values. Definition at line 1261 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::pos_format(). template<typename _CharT , bool _Intl> virtual string_type std::moneypunct< _CharT, _Intl >::do_positive_sign () const [inline], [protected], [virtual], [inherited] Return positive sign string. This function returns a string_type to use as a sign for positive amounts. This function is a hook for derived classes to change the value returned. See Also: positive_sign() for details. Returns: string_type representing a positive sign. Definition at line 1220 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::positive_sign(). template<typename _CharT , bool _Intl> virtual char_type std::moneypunct< _CharT, _Intl >::do_thousands_sep () const [inline], [protected], [virtual], [inherited] Return thousands separator character. Returns a char_type to use as a thousands separator. This function is a hook for derived classes to change the value returned. Returns: char_type representing a thousands separator. Definition at line 1181 of file locale_facets_nonio.h. Referenced by std::moneypunct< _CharT, _Intl >::thousands_sep(). template<typename _CharT , bool _Intl> int std::moneypunct< _CharT, _Intl >::frac_digits () const [inline], [inherited] Return number of digits in fraction. This function returns the exact number of digits that make up the fractional part of a money amount. It does so by returning returning moneypunct<char_type>::do_frac_digits(). The fractional part of a money amount is optional. But if it is present, there must be frac_digits() digits. Returns: Number of digits in amount fraction. Definition at line 1111 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_frac_digits(). template<typename _CharT , bool _Intl> string std::moneypunct< _CharT, _Intl >::grouping () const [inline], [inherited] Return grouping specification. This function returns a string representing groupings for the integer part of an amount. Groupings indicate where thousands separators should be inserted. Each char in the return string is interpret as an integer rather than a character. These numbers represent the number of digits in a group. The first char in the string represents the number of digits in the least significant group. If a char is negative, it indicates an unlimited number of digits for the group. If more chars from the string are required to group a number, the last char is used repeatedly. For example, if the grouping() returns 0302 and is applied to the number 123456789, this corresponds to 12,34,56,789. Note that if the string was 32, this would put more than 50 digits into the least significant group if the character set is ASCII. The string is returned by calling moneypunct<char_type>::do_grouping(). Returns: string representing grouping specification. Definition at line 1048 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_grouping(). template<typename _CharT , bool _Intl> pattern std::moneypunct< _CharT, _Intl >::neg_format () const [inline], [inherited] Return pattern for money values. This function returns a pattern describing the formatting of a positive or negative valued money amount. It does so by returning returning moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format(). The pattern has 4 fields describing the ordering of symbol, sign, value, and none or space. There must be one of each in the pattern. The none and space enums may not appear in the first field and space may not appear in the final field. The parts of a money string must appear in the order indicated by the fields of the pattern. The symbol field indicates that the value of curr_symbol() may be present. The sign field indicates that the value of positive_sign() or negative_sign() must be present. The value field indicates that the absolute value of the money amount is present. none indicates 0 or more whitespace characters, except at the end, where it permits no whitespace. space indicates that 1 or more whitespace characters must be present. For example, for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() == '+', and value 10.01, and options set to force the symbol, the corresponding string is $+10.01. Returns: Pattern for money values. Definition at line 1151 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_neg_format(). template<typename _CharT , bool _Intl> string_type std::moneypunct< _CharT, _Intl >::negative_sign () const [inline], [inherited] Return negative sign string. This function returns a string_type to use as a sign for negative amounts. It does so by returning returning moneypunct<char_type>::do_negative_sign(). If the return value contains more than one character, the first character appears in the position indicated by neg_format() and the remainder appear at the end of the formatted string. Returns: string_type representing a negative sign. Definition at line 1095 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_negative_sign(). template<typename _CharT , bool _Intl> pattern std::moneypunct< _CharT, _Intl >::pos_format () const [inline], [inherited] Return pattern for money values. This function returns a pattern describing the formatting of a positive or negative valued money amount. It does so by returning returning moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format(). The pattern has 4 fields describing the ordering of symbol, sign, value, and none or space. There must be one of each in the pattern. The none and space enums may not appear in the first field and space may not appear in the final field. The parts of a money string must appear in the order indicated by the fields of the pattern. The symbol field indicates that the value of curr_symbol() may be present. The sign field indicates that the value of positive_sign() or negative_sign() must be present. The value field indicates that the absolute value of the money amount is present. none indicates 0 or more whitespace characters, except at the end, where it permits no whitespace. space indicates that 1 or more whitespace characters must be present. For example, for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() == '+', and value 10.01, and options set to force the symbol, the corresponding string is $+10.01. Returns: Pattern for money values. Definition at line 1147 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_pos_format(). template<typename _CharT , bool _Intl> string_type std::moneypunct< _CharT, _Intl >::positive_sign () const [inline], [inherited] Return positive sign string. This function returns a string_type to use as a sign for positive amounts. It does so by returning returning moneypunct<char_type>::do_positive_sign(). If the return value contains more than one character, the first character appears in the position indicated by pos_format() and the remainder appear at the end of the formatted string. Returns: string_type representing a positive sign. Definition at line 1078 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_positive_sign(). template<typename _CharT , bool _Intl> char_type std::moneypunct< _CharT, _Intl >::thousands_sep () const [inline], [inherited] Return thousands separator character. This function returns a char_type to use as a thousands separator. It does so by returning returning moneypunct<char_type>::do_thousands_sep(). Returns: char_type representing a thousands separator. Definition at line 1018 of file locale_facets_nonio.h. References std::moneypunct< _CharT, _Intl >::do_thousands_sep(). Member Data Documentation template<typename _CharT , bool _Intl> locale::id std::moneypunct< _CharT, _Intl >::id [static], [inherited] Numpunct facet id. Definition at line 953 of file locale_facets_nonio.h. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Nov 27 2012 std::moneypunct_byname< _CharT, _Intl >(3cxx)
All times are GMT -4. The time now is 07:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy