![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Read a string with leading spaces and find the length of the string | dayamatrix | UNIX for Dummies Questions & Answers | 2 | 11-13-2008 10:08 AM |
| regarding string length | amitpansuria | High Level Programming | 10 | 10-05-2008 04:10 AM |
| length of string | silas.john | UNIX for Dummies Questions & Answers | 8 | 02-06-2008 07:22 PM |
| read string, check string length and cut | ozzy80 | Shell Programming and Scripting | 9 | 03-21-2007 05:56 PM |
| sed problem - replacement string should be same length as matching string. | amangeles | Shell Programming and Scripting | 4 | 01-11-2006 06:11 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
matching string in two files of different length
Dear all,
I have the following problem (it originates in the domain of bio-inf, but it is a general problem). I have two files of one column each and of different length: a.txt and b.txt. a.txt contains alphanumeric strings (around 30 digit) and there are 300 rows b.txt contains alphanumeric strings (around 1000 digit) and there are 16 rows I want to check (of course for every row) if the string in a.txt is contained by any of the 16 string in b.txt, and if it is the case print the corresponding (long) string of b.txt I have tried with a "for" cycle and the gawk lines Code:
for string_b in [... the 16 strings separated by a space ...]; do
awk "{if (match(${string_b},/'\$1'/)){print '${string_b}' else {print 'nulla'}}" < string_a.txt > result
done
Many thanks! Any help or suggestion is welcome! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|