Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Find all .sh files in file system and need to replace the string inside .sh files Post 303038021 by bhas85 on Wednesday 21st of August 2019 12:57:22 PM
Old 08-21-2019
Find all .sh files in file system and need to replace the string inside .sh files

Hi All,
I need to write a script to find all "*.sh" files in /home file system and if any string find "*.sh" files with the name vijay@gmail.com need to replace with vijay.bhaskar@gmail.com. I just understood about the find the command to search .sh files. Please help me on this.
Code:
find / -name "*.sh" -print 2>/dev/null

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find and replace a string in multiple files

I used the following script cd pathname for y in `ls *`; do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y; done and it worked fine for finding and replacing strings with names etc. in all files of the given path. I'm trying to replace a string which consists of path (location of file) ... (2 Replies)
Discussion started by: pharos467
2 Replies

2. Shell Programming and Scripting

How to find a string inside files

Hi, I would like to know how to get a list of files that contain a specific string inside them. Thanks (12 Replies)
Discussion started by: yoavbe
12 Replies

3. Shell Programming and Scripting

find and replace string in a directory files

Hi, I have a directory has DIR1 and the D1 directory has 200+ files. I want change the string from "Bangalore" to "Bangaluru" in all files in the D1 directory. Thanks (2 Replies)
Discussion started by: koti_rama
2 Replies

4. Shell Programming and Scripting

shell script to find and replace string in multiple files

I used the following script cd pathname for y in `ls *`; do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y; done and it worked fine for finding and replacing strings with names etc. in all files of the given path. I'm trying to replace a string which consists of path (location of file) ... (11 Replies)
Discussion started by: pharos467
11 Replies

5. Shell Programming and Scripting

find and replace a search string recursively in files

Hi , I have a directory structure as dir and subdirectories and files under it and so on.now I need to find the files which contain the search string under every dir and subdir and replace . my search string is like searchstring=/a/b string to be replaced=/a/c/b please help. ... (7 Replies)
Discussion started by: mohanpadamata
7 Replies

6. Shell Programming and Scripting

Find & Replace string in multiple files & folders using perl

find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g' this is simple logic to find and replace in multiple files & folders Hope this helps. Thanks Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies

7. Shell Programming and Scripting

Find text containing paths and replace with a string in all the python files

I have 100+ python files in a single directory. I need to replace a specific path occurrence with a variable name. Following are the find and the replace strings: Findstring--"projects\\Debugger\\debugger_dp8051_01\\debugger_dp8051_01.cywrk" Replacestring--self.projpath I tried... (5 Replies)
Discussion started by: noorsam
5 Replies

8. UNIX for Dummies Questions & Answers

Finding files with a certain name string inside of another file.

Hi, I have a very large file that contains a listing of all files on the system. I need to create a listing from that file of all files that start with the following format: s???_*, whereas the '?' represents characters, so the file name begins with an 's' followed by three other characters and... (4 Replies)
Discussion started by: tes218
4 Replies

9. Ubuntu

Trying to find files on a system that contain a certain string

I have tried just about every find and grep command possible and I cannot find these damn files!! This is the problem: On the node you just swapped in, there are 5 JPEG files whose names contain the word "intro" in some form. Find all five files from on the entire disk (i.e. from root /). ... (2 Replies)
Discussion started by: dukeu69
2 Replies

10. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies
Email::Find(3pm)					User Contributed Perl Documentation					  Email::Find(3pm)

NAME
Email::Find - Find RFC 822 email addresses in plain text SYNOPSIS
use Email::Find; # new object oriented interface my $finder = Email::Find->new(&callback); my $num_found - $finder->find($text); # good old functional style $num_found = find_emails($text, &callback); DESCRIPTION
Email::Find is a module for finding a subset of RFC 822 email addresses in arbitrary text (see "CAVEATS"). The addresses it finds are not guaranteed to exist or even actually be email addresses at all (see "CAVEATS"), but they will be valid RFC 822 syntax. Email::Find will perform some heuristics to avoid some of the more obvious red herrings and false addresses, but there's only so much which can be done without a human. METHODS
new $finder = Email::Find->new(&callback); Constructs new Email::Find object. Specified callback will be called with each email as they're found. find $num_emails_found = $finder->find($text); Finds email addresses in the text and executes callback registered. The callback is given two arguments. The first is a Mail::Address object representing the address found. The second is the actual original email as found in the text. Whatever the callback returns will replace the original text. FUNCTIONS
For backward compatibility, Email::Find exports one function, find_emails(). It works very similar to URI::Find's find_uris(). EXAMPLES
use Email::Find; # Simply print out all the addresses found leaving the text undisturbed. my $finder = Email::Find->new(sub { my($email, $orig_email) = @_; print "Found ".$email->format." "; return $orig_email; }); $finder->find($text); # For each email found, ping its host to see if its alive. require Net::Ping; $ping = Net::Ping->new; my %Pinged = (); my $finder = Email::Find->new(sub { my($email, $orig_email) = @_; my $host = $email->host; next if exists $Pinged{$host}; $Pinged{$host} = $ping->ping($host); }); $finder->find($text); while( my($host, $up) = each %Pinged ) { print "$host is ". $up ? 'up' : 'down' ." "; } # Count how many addresses are found. my $finder = Email::Find->new(sub { $_[1] }); print "Found ", $finder->find($text), " addresses "; # Wrap each address in an HTML mailto link. my $finder = Email::Find->new( sub { my($email, $orig_email) = @_; my($address) = $email->format; return qq|<a href="mailto:$address">$orig_email</a>|; }, ); $finder->find($text); SUBCLASSING
If you want to change the way this module works in finding email address, you can do it by making your subclass of Email::Find, which over- rides "addr_regex" and "do_validate" method. For example, the following class can additionally find email addresses with dot before at mark. This is illegal in RFC822, see Email::Valid::Loose for details. package Email::Find::Loose; use base qw(Email::Find); use Email::Valid::Loose; # should return regex, which Email::Find will use in finding # strings which are "thought to be" email addresses sub addr_regex { return $Email::Valid::Loose::Addr_spec_re; } # should validate $addr is a valid email or not. # if so, return the address as a string. # else, return undef sub do_validate { my($self, $addr) = @_; return Email::Valid::Loose->address($addr); } Let's see another example, which validates if the address is an existent one or not, with Mail::CheckUser module. package Email::Find::Existent; use base qw(Email::Find); use Mail::CheckUser qw(check_email); sub do_validate { my($self, $addr) = @_; return check_email($addr) ? $addr : undef; } CAVEATS
Why a subset of RFC 822? I say that this module finds a subset of RFC 822 because if I attempted to look for all possible valid RFC 822 addresses I'd wind up practically matching the entire block of text! The complete specification is so wide open that its difficult to construct soemthing that's not an RFC 822 address. To keep myself sane, I look for the 'address spec' or 'global address' part of an RFC 822 address. This is the part which most people consider to be an email address (the 'foo@bar.com' part) and it is also the part which contains the information necessary for delivery. Why are some of the matches not email addresses? Alas, many things which aren't email addresses look like email addresses and parse just fine as them. The biggest headache is email and usenet and email message IDs. I do my best to avoid them, but there's only so much cleverness you can pack into one library. AUTHORS
Copyright 2000, 2001 Michael G Schwern <schwern@pobox.com>. All rights reserved. Current maintainer is Tatsuhiko Miyagawa <miyagawa@bulknews.net>. THANKS
Schwern thanks to Jeremy Howard for his patch to make it work under 5.005. LICENSE
This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself. The author STRONGLY SUGGESTS that this module not be used for the purposes of sending unsolicited email (ie. spamming) in any way, shape or form or for the purposes of generating lists for commercial sale. If you use this module for spamming I reserve the right to make fun of you. SEE ALSO
Email::Valid, RFC 822, URI::Find, Apache::AntiSpam, Email::Valid::Loose perl v5.8.8 2006-03-18 Email::Find(3pm)
All times are GMT -4. The time now is 09:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy