Sponsored Content
Top Forums Shell Programming and Scripting Multiple pattern search in perl Post 302544280 by Skrynesaver on Wednesday 3rd of August 2011 10:28:51 AM
Old 08-03-2011
Are you expecting a script that you can supply 2 arguments to:
Code:
my_script.pl user_data.dat  nusage.py

which returns all users with nusage.py in their values list?
Code:
~/ $ perl -e 'open DATA , "<", "tmp.dat";while(<DATA>){ if (/^user\s+(\d+)$/){ $uid=$1;}if(/$ARGV[0]/){print "user $uid matches\n"}}' gusage.py
user 11 matches
~/$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern search in multiple lines

Hi, I have to search those statements from the file which starts from "shanky"(only shanky, shanky09 or 09shanky is not allowed) and ends with ");". These two string can be in a same line or different line. And also i have to negate those lines which starts with #. Can any one please give me... (2 Replies)
Discussion started by: shanky09
2 Replies

2. Shell Programming and Scripting

perl:: search for tow pattern and replace the third pattern

Hi i want to search two pattern on same line and replace onther pattern.. INPut file aaaa bbbbb nnnnnn ttttt cccc bbbbb nnnnnn ppppp dddd ccccc nnnnnn ttttt ffff bbbbb oooooo ttttt now i want replace this matrix like.. i want search for "bbbbb","nnnnnn" and search and replace for... (4 Replies)
Discussion started by: nitindreamz
4 Replies

3. Shell Programming and Scripting

perl pattern search

can someone help me out with the bolded? else if (regmatch($Subject, "^Application") && (regmatch($From, "^etgh") && (regmatch($Body, ".*not authorized to use this server.*")))) what this section of the code is suppose to do is to scan through the contents of $Body, if do a set of... (1 Reply)
Discussion started by: SkySmart
1 Replies

4. Shell Programming and Scripting

search more than one pattern with perl on same line

Hi friends, I want to search for some hex error codes in some files. After the hex error code is found, the occurences would be counted. Afterwards the found hex errorcode would be cat into a separate file. Here is my code: #!/usr/bin/perl use File::Basename; my $find = $ARGV; my... (2 Replies)
Discussion started by: sdohn
2 Replies

5. Shell Programming and Scripting

Help need with PERL multiple search pattern matching!

My example file is as given below: conn=1 uid=oracle conn=2 uid=db2 conn=3 uid=oracle conn=4 uid=hash conn=5 uid=skher conn=6 uid=oracle conn=7 uid=mpalkar conn=8 uid=anarke conn=9 uid=oracle conn=1 op=-1 msgId=-1 - fd=104 slot=104 LDAPS connection from 10.10.5.6 to 10.18.6.5 conn=2... (3 Replies)
Discussion started by: sags007_99
3 Replies

6. Shell Programming and Scripting

Multiple search pattern

Hello :) I have this file cat employee_list Name : jack Gender: m ID : 4512 DOB : 03/27/1980 hire date : 04/23/2012 Nationality: US marital status : single ===================== Name : mick Gender: m ID : 1256 DOB : 03/27/1970 Hire date : 012/10/2011 Nationality: US Marital... (4 Replies)
Discussion started by: Sara_84
4 Replies

7. Shell Programming and Scripting

awk with multiple pattern search

Want to fetch a column with multiple pattern using awk. How to achieve the same. Tried cat test address : 10.63.20.92/24 address : 10.64.22.93/24 address : 10.53.40.91/24 cat test | awk '{print $3}' |awk -F "/" '{print $1}' 10.63.20.92 10.64.22.93 10.53.40.91 Is there any... (2 Replies)
Discussion started by: Manasa Pradeep
2 Replies

8. Linux

Search multiple pattern from list

I am working on AIX operating system. I want to search list of Article Id for given Set Date (which are present in a seperate file input.txt) art_list.csv ------------ "Article ID" |"Ad Description" |"Pyramid"|"Pyramid Desc "|"ProductTypeId"|"Set Date "|... (3 Replies)
Discussion started by: rajivrsk
3 Replies

9. Shell Programming and Scripting

Search multiple pattern in a file

I have a sample file with following output: HTTP/1.1 200 OK User: admin Set-Cookie: AMBARISESSIONID=y3v3648yqcno32nq478kw7ar;Path=/;HttpOnly Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: text/plain Vary: Accept-Encoding, User-Agent Content-Length: 6057 Server:... (4 Replies)
Discussion started by: saurau
4 Replies

10. Shell Programming and Scripting

Pattern search multiple files

#!/usr/bin/ksh a="Run successfully" cd $APPS ls -l *.txt | while read $txt do if then cp $APPS/$txt cp $hist/$txt else rm $APPS/$txt echo "Files has been removed" fi done New in shell script please help me out Around 100 txt files in $APPS dir i want to search pattern from... (8 Replies)
Discussion started by: Kalia
8 Replies
Gtk2::Clipboard(3pm)					User Contributed Perl Documentation				      Gtk2::Clipboard(3pm)

NAME
Gtk2::Clipboard - wrapper for GtkClipboard HIERARCHY
Glib::Object +----Gtk2::Clipboard METHODS
$clipboard->set_can_store (...) o ... (list) of Gtk2::TargetEntry's Since: gtk+ 2.6 $clipboard->clear display = $clipboard->get_display Since: gtk+ 2.2 clipboard = Gtk2::Clipboard->get_for_display ($display, $selection) o $display (Gtk2::Gdk::Display) o $selection (Gtk2::Gdk::Atom) Since: gtk+ 2.2 clipboard = Gtk2::Clipboard->get ($selection) o $selection (Gtk2::Gdk::Atom) $clipboard->set_image ($pixbuf) o $pixbuf (Gtk2::Gdk::Pixbuf) Since: gtk+ 2.6 object = $clipboard->get_owner $clipboard->request_contents ($target, $callback, $user_data=undef) o $target (Gtk2::Gdk::Atom) o $callback (scalar) o $user_data (scalar) $clipboard->request_image ($callback, $user_data=undef) o $callback (scalar) o $user_data (scalar) Since: gtk+ 2.6 $clipboard->request_rich_text ($buffer, $callback, $user_data=undef) o $buffer (Gtk2::TextBuffer) o $callback (scalar) o $user_data (scalar) Since: gtk+ 2.10 $clipboard->request_targets ($callback, $user_data=undef) o $callback (scalar) o $user_data (scalar) Since: gtk+ 2.4 $clipboard->request_text ($callback, $user_data=undef) o $callback (scalar) o $user_data (scalar) $clipboard->request_uris ($func, $data=undef) o $func (scalar) o $data (scalar) Since: gtk+ 2.14 $clipboard->store Since: gtk+ 2.6 $clipboard->set_text ($text) o $text (string) selectiondata or undef = $clipboard->wait_for_contents ($target) o $target (Gtk2::Gdk::Atom) pixbuf or undef = $clipboard->wait_for_image Since: gtk+ 2.6 list = $clipboard->wait_for_rich_text ($buffer) o $buffer (Gtk2::TextBuffer) Since: gtk+ 2.10 list = $clipboard->wait_for_targets Returns a list of GdkAtom's. Since: gtk+ 2.4 string = $clipboard->wait_for_text scalar = $clipboard->wait_for_uris Since: gtk+ 2.14 boolean = $clipboard->wait_is_image_available Since: gtk+ 2.6 boolean = $clipboard->wait_is_rich_text_available ($buffer) o $buffer (Gtk2::TextBuffer) Since: gtk+ 2.10 boolean = $clipboard->wait_is_target_available ($target) o $target (Gtk2::Gdk::Atom) Since: gtk+ 2.6 boolean = $clipboard->wait_is_text_available boolean = $clipboard->wait_is_uris_available Since: gtk+ 2.14 boolean = $clipboard->set_with_data ($get_func, $clear_func, $user_data, ...) o $get_func (scalar) o $clear_func (scalar) o $user_data (scalar) o ... (list) of Gtk2::TargetEntry's boolean = $clipboard->set_with_owner ($get_func, $clear_func, $owner, ...) o $get_func (scalar) o $clear_func (scalar) o $owner (Glib::Object) o ... (list) of Gtk2::TargetEntry's SIGNALS
owner-change (Gtk2::Clipboard, Gtk2::Gdk::Event) SEE ALSO
Gtk2, Glib::Object COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::Clipboard(3pm)
All times are GMT -4. The time now is 07:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy