Sponsored Content
Full Discussion: Help With Backward grep
Top Forums UNIX for Dummies Questions & Answers Help With Backward grep Post 302573980 by boaz733 on Wednesday 16th of November 2011 08:07:29 AM
Old 11-16-2011
Wrench Help With Backward grep

hey, i got 2 files with the following content:

file1:
Code:
LOCAL_GSK1
50:01:24:80:45:f1:15:23
50:01:24:81:45:f1:15:23
50:01:24:82:45:f1:15:23
50:01:24:83:45:f1:15:23
LOCAL_GSK2
50:01:24:82:00:9c:d7:a7
50:01:24:82:01:bc:d7:a7
50:01:24:82:02:dc:d7:a7
50:01:24:82:03:fc:d7:a7
LOCAL_GSK3
50:01:24:80:45:39:a7:0b
50:01:24:81:45:39:a7:0b
50:01:24:82:45:39:a7:0b
50:01:24:83:45:39:a7:0b
LOCAL_GSK4
50:01:24:80:45:c1:3b:33
50:01:24:81:45:c1:3b:33
50:01:24:82:45:c1:3b:33
50:01:24:83:45:c1:3b:33
REMOTE_GSK1
50:01:24:80:45:bd:3e:5f
50:01:24:81:45:bd:3e:5f
50:01:24:82:45:bd:3e:5f
50:01:24:83:45:bd:3e:5f

file2:
Code:
10:00:00:05:1e:03:65:59
10:00:00:05:1e:03:65:59
50:00:09:73:10:03:71:04
50:00:09:73:10:03:71:05
50:00:09:73:10:03:71:00
50:00:09:73:10:03:71:01
50:01:24:80:45:bd:3e:5f
50:01:24:81:45:bd:3e:5f
50:01:24:80:45:31:ad:63
50:01:24:81:45:31:ad:63
50:01:24:80:45:69:80:fb
50:01:24:81:45:69:80:fb
50:01:24:80:45:39:a7:0b
50:01:24:81:45:39:a7:0b
21:00:00:24:ff:30:35:7b
21:00:00:24:ff:30:35:7a
21:00:00:24:ff:30:35:6a
21:00:00:24:ff:30:35:6b
21:00:00:24:ff:30:35:7e
21:00:00:24:ff:30:35:7f

what i need is to search in file1 and compare it to file2
if a match was found then
print the match found and the group name
for example searching for:
file1
Code:
50:01:24:81:45:bd:3e:5f
50:01:24:81:45:39:a7:0b

will print this from file2
Code:
REMOTE_GSK1
50:01:24:81:45:bd:3e:5f
LOCAL_GSK3
50:01:24:81:45:39:a7:0b

any help would be appreciated Smilie
thank u all.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find the current cursor word in backward

hello, i'm using the vi editor (not vim) and my main use in it is for C++ programming. After working on Visual Studio 2005 the auto-complete looks like paradise now... so i'm trying to find a way to have auto-complete also in the vi. i cant install vim and use the ctrl+P. i need to find a way... (1 Reply)
Discussion started by: Malbinir
1 Replies

2. UNIX for Advanced & Expert Users

Substitute single backward-slash with the double backward-slash

Hi, I have a path like this c:\test\sample\programs, i need to change thiis to c:\\test\\sample\\programs. How to perform this? I tried tr command but it didn't help me. Thanks Vijayan (3 Replies)
Discussion started by: mvictorvijayan
3 Replies

3. Shell Programming and Scripting

forward/backward capable prompt

Hi, I would like to construct an interactive prompt for a series of bash shell scripts. This prompt will ask the user a series of questions, and the answers will determine which scripts are run, and in which order. I am familiar with the "read" command, and have successfully constructed a... (2 Replies)
Discussion started by: msb65
2 Replies

4. Shell Programming and Scripting

Using sed to append backward slash before forward slash

Hi all, I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
Discussion started by: sarbjit
2 Replies

5. SCO

sco unix backward compatibility on "max open file per process"

Hi How to increase maximum number of open file in "sco xenix binary" running in "sco unix openserver 5.0.7" ? I have changed "NOFILES" kernel parameter to 512, but xenix binray can't open more than 60. tnx (4 Replies)
Discussion started by: javad1_maroofi
4 Replies

6. Shell Programming and Scripting

backward string cut

I need only the last .ko files to be stripped from the whole result., ie libiscsi2.ko, scsi_transport_iscsi2.ko etc.. kernel/drivers/scsi/libiscsi2.ko kernel/drivers/scsi/scsi_transport_iscsi2.ko kernel/drivers/scsi/scsi_transport_iscsi.ko kernel/fs/nls/nls_utf8.ko... (4 Replies)
Discussion started by: anilcliff
4 Replies

7. Programming

Backward compatibility in python

Actually I have installed python 3.2. It seems there are a lot of synta variance between 2.2 and 3.2. Is it possible to run a script in 2.2 without actually installing 2.2. But I have installed 3.2. and also is it possible to access the 2.2 shell in 3.2 version. I am naive in python . Please... (1 Reply)
Discussion started by: pandeesh
1 Replies

8. Shell Programming and Scripting

How to use sed to search a particular pattern in a file backward after a pattern is matched.?

Hi, I have two files file1.txt and file2.txt. Please see the attachments. In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
Discussion started by: saurabh kumar
9 Replies

9. Shell Programming and Scripting

Backward compatibility issue with GNU bash, version 4.3.42(5)

Hi, I have made a snake game on below bash version. But it is not backward compatible. Can someone suggest a version which is most commonly used and is backward compatible so that i can change my code and share again? I have attached the game script. If someone can run it please also suggest... (5 Replies)
Discussion started by: amit14august
5 Replies
Locale::Codes::LangFam(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangFam(3pm)

NAME
Locale::Codes::LangFam - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangFam; $lext = code2langfam('apa'); # $lext gets 'Apache languages' $code = langfam2code('Apache languages'); # $code gets 'apa' @codes = all_langfam_codes(); @names = all_langfam_names(); DESCRIPTION
The "Locale::Codes::LangFam" module provides access to standard codes used for identifying language families, such as those as defined in ISO 639-5. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639-5 language family codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language families. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langfam('apa','alpha'); $lext = code2langfam('apa',LOCALE_LANGFAM_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from ISO 639-5 such as 'apa' for Apache languages. This is the default code set. ROUTINES
code2langfam ( CODE [,CODESET] ) langfam2code ( NAME [,CODESET] ) langfam_code2code ( CODE ,CODESET ,CODESET2 ) all_langfam_codes ( [CODESET] ) all_langfam_names ( [CODESET] ) Locale::Codes::LangFam::rename_langfam ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangFam::add_langfam ( CODE ,NAME [,CODESET] ) Locale::Codes::LangFam::delete_langfam ( CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_alias ( NAME ,NEW_NAME ) Locale::Codes::LangFam::delete_langfam_alias ( NAME ) Locale::Codes::LangFam::rename_langfam_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::delete_langfam_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.loc.gov/standards/iso639-5/id.php ISO 639-5 . AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Locale::Codes::LangFam(3pm)
All times are GMT -4. The time now is 11:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy