Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Pattern search multiple files

Shell Programming and Scripting


Reply    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 06-19-2017   -   Original Discussion by Kalia
Kalia Kalia is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 10 November 2017, 4:16 PM EST
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Output as below.

Code:
Exit successfully==== file not contained pattern 
Exit successfully======file not contained pattern 
Exit successfully======file not contained pattern 
Exit successfully======file not contained pattern 

filename would had been copied to $HIST/${filename#./} filed contained.


But i need output should be display only the true part not false part if any of the files contained pattern then copy if not then go to else part

ex:it should be display only this filename would had been copied to $HIST/${filename#./} filed contained.


Moderator's Comments:
Pattern search multiple files Please use CODE tags as required by forum rules!

Last edited by RudiC; 06-19-2017 at 11:16 AM.. Reason: Added CODE tags.
Sponsored Links
    #9  
Old Unix and Linux 06-19-2017   -   Original Discussion by Kalia
Aia's Unix or Linux Image
Aia Aia is offline
Registered User
 
Join Date: May 2008
Last Activity: 20 November 2017, 9:27 AM EST
Posts: 1,673
Thanks: 49
Thanked 641 Times in 601 Posts
Quote:
Originally Posted by Kalia View Post
Output as below.

Code:
Exit successfully==== file not contained pattern 
Exit successfully======file not contained pattern 
Exit successfully======file not contained pattern 
Exit successfully======file not contained pattern 

filename would had been copied to $HIST/${filename#./} filed contained.


But i need output should be display only the true part not false part if any of the files contained pattern then copy if not then go to else part

ex:it should be display only this filename would had been copied to $HIST/${filename#./} filed contained.


Moderator's Comments:
Pattern search multiple files Please use CODE tags as required by forum rules!
Please, post your latest iteration of your script.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search multiple pattern in a file saurau Shell Programming and Scripting 4 08-04-2015 10:08 AM
awk with multiple pattern search Manasa Pradeep Shell Programming and Scripting 2 06-25-2013 03:36 AM
Multiple search pattern Sara_84 Shell Programming and Scripting 4 04-02-2013 10:04 AM
pattern search for multiple log files and counting gubbu Shell Programming and Scripting 3 09-10-2009 04:57 PM
Pattern search in multiple lines shanky09 Shell Programming and Scripting 2 04-02-2009 05:29 AM



All times are GMT -4. The time now is 12:42 PM.