Sponsored Content
Top Forums Shell Programming and Scripting Print two matched words from the same line Post 302367282 by binnybio on Monday 2nd of November 2009 05:14:28 AM
Old 11-02-2009
Print two matched words from the same line

Hi experts

I need to pick 2 matched words from the same line.....
I have given below an example file

eg:
Code:
O14757 hsa04110 hsa04115 2 P38398 hsa04120 1 
O15111 hsa04010 hsa04210 hsa04920 hsa04620 hsa04660 hsa04662 hsa05200 hsa05212 hsa05221 hsa05220 hsa05215 hsa05222 hsa05120 13 O14920 hsa04010 hsa04210 hsa04910 hsa04920 hsa04620 hsa04660 hsa04662 hsa05200 hsa05212 hsa05221 hsa05220 hsa05215 hsa05222 hsa04930 hsa05120 15 
O15264 hsa04010 hsa04370 hsa04912 hsa04620 hsa04664 hsa04670 hsa05014 hsa05120 8 Q15139 
O15297 hsa04115 1 Q00987 hsa04120 hsa04110 hsa04115 hsa05200 hsa05214 hsa05220 hsa05218 hsa05219 hsa05215 9 
O43464 hsa05012 1 P98170 hsa04120 hsa04210 hsa04510 hsa05200 hsa05222 5

From the above file i have to pick only the 6 letter alphanumerical words(highlighted words) in the given below format

ie,
Code:
 O14757    P38398 
 O15111    O14920

Pls reply me asap

Last edited by pludi; 11-02-2009 at 06:20 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print only last two words of a line

can u help me out to print last two words of each sentence of a file. for example. contents of input file: i love songs my favourite songs sent songs all kind good buddy Ouput file should contain: love songs favourite songs sent all kind good buddy (5 Replies)
Discussion started by: pradeepreddy
5 Replies

2. Shell Programming and Scripting

How to print the words in the same line with space or to the predefined line?

HI, cat test abc echo "def" >> test output is cat test abc def the needed output is cat test abc def and so on (5 Replies)
Discussion started by: jobycxa
5 Replies

3. Shell Programming and Scripting

AWK Print Line If Specific Character Is Matched

Hello, I have a file as such: FFFFFFF6C000000 225280 225240 - - rwxs- FFFFFFFF79C00000 3240 3240 - - rwxs- FFFFFFFF7A000000 4096 4096 - - rwxs- FFFFFFFF7A400000 64 64 ... (3 Replies)
Discussion started by: PointyWombat
3 Replies

4. Shell Programming and Scripting

print number of words in each line

Hi, Please suggest a way to print number of words in the end of each line. <input file> red aunt house blue sky bat and ball game <output file> red aunt house 3 blue sky 2 bat and ball game 4 Thanks! (2 Replies)
Discussion started by: mira
2 Replies

5. Shell Programming and Scripting

Print only matched string instead of entire line

Hi, I have a file whose lines are something like Tchampionspsq^@~^@^^^A^@^@^@^A^A^Aÿð^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^?ð^@^@^@^@^@^@^@?ð^@^@^@^@^@^@pppsq^@~^@#@^@^@^@^@^@^Hw^H^@^@^@^K^@^@^@^@xp^At^@^FTtime2psq^@ ~^@^^^A^@^@^@^B^A I need to extract all words matching T*psq from the file. Thing is... (4 Replies)
Discussion started by: shekhar2010us
4 Replies

6. Shell Programming and Scripting

Print line between two patterns when a certain pattern matched

Hello Friends, I need to print lines in between two string when a keyword existed in those lines (keywords like exception, error, failed, not started etc). for example, input: .. Begin Edr ab12 ac13 ad14 bc23 exception occured bd24 cd34 dd44 ee55 ff66 End Edr (2 Replies)
Discussion started by: EAGL€
2 Replies

7. Shell Programming and Scripting

Regex: print matched line and exact pattern match

Hi experts, I have a file with regexes which is used for automatic searches on several files (40+ GB). To do some postprocessing with the grep result I need the matching line as well as the match itself. I know that the latter could be achieved with grep's -o option. But I'm not aware of a... (2 Replies)
Discussion started by: stresing
2 Replies

8. UNIX for Advanced & Expert Users

To print from the first line until pattern is matched

Hi I want to print the line until pattern is matched. I am using below code: sed -n '1,/pattern / p' file It is working fine for me , but its not working for exact match. sed -n '1,/^LAC$/ p' file Input: LACC FEGHRA 0 LACC FACAF 0 LACC DARA 0 LACC TALAC 0 LAC ILACTC 0... (8 Replies)
Discussion started by: Abhisrajput
8 Replies

9. Shell Programming and Scripting

How to print two matched patterns only from each line?

My input looks like this. # Lot Of CODE Before AppType_somethinglese=$(cat << EOF AppType_test1='test-tool/blatest-tool-ear' AppType_test2='test/blabla-ear' # Lot Of CODE After I want to print text betwen 1) _ and = and 2)/ and ' from each line and exclude lines with "EOF". Output... (2 Replies)
Discussion started by: kchinnam
2 Replies

10. Shell Programming and Scripting

How to print previous line of multiple pattern matched line?

Hello, I have below format log file, Comparing csv_converted_files/2201/9747.1012H67126.5077292103609547345.csv and csv_converted_files/22019/97447.1012H67126.5077292103609547345.csv Comparing csv_converted_files/2559/9447.1012H67126.5077292103609547345.csv and... (6 Replies)
Discussion started by: arvindshukla81
6 Replies
Lingua::Stem::Sv(3pm)					User Contributed Perl Documentation				     Lingua::Stem::Sv(3pm)

NAME
Lingua::Stem::Sv - Stemming algorithm for Swedish SYNOPSIS
use Lingua::Stem::Sv; my $stems = Lingua::Stem::Sv::stem({ -words => $word_list_reference, -locale => 'sv', -exceptions => $exceptions_hash, }); DESCRIPTION
This routine applies a stemming slgorithm to a passed anon array of Swedish words, returning the stemmed words as an anon array. It is a 'convienence' wrapper for 'Lingua::Stem::Snowball::Se' that provides a standardized interface and caching. CHANGES
1.01 2003.09.28 - Documentation fix 1.00 2003.04.05 - Initial release METHODS
stem({ -words => @words, -locale => 'sv', -exceptions => \%exceptions }); Stems a list of passed words using the rules of Swedish. Returns an anonymous array reference to the stemmed words. Example: my $stemmed_words = Lingua::Stem::Sv::stem({ -words => @words, -locale => 'sv', -exceptions => \%exceptions, }); stem_caching({ -level => 0|1|2 }); Sets the level of stem caching. '0' means 'no caching'. This is the default level. '1' means 'cache per run'. This caches stemming results during a single call to 'stem'. '2' means 'cache indefinitely'. This caches stemming results until either the process exits or the 'clear_stem_cache' method is called. clear_stem_cache; Clears the cache of stemmed words NOTES
This code is a wrapper around Lingua::Stem::Snowball::Sv written by Ask Solem Hoel, <ask@unixmonks.net> SEE ALSO
Lingua::Stem Lingua::Stem::Snowball::Sv AUTHOR
Integration in Lingua::Stem by Benjamin Franz, FreeRun Technologies, snowhare@nihongo.org or http://www.nihongo.org/snowhare/ COPYRIGHT
Benjamin Franz, FreeRun Technologies This code is freely available under the same terms as Perl. BUGS
TODO
perl v5.10.1 2007-10-23 Lingua::Stem::Sv(3pm)
All times are GMT -4. The time now is 02:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy