Sponsored Content
Top Forums Shell Programming and Scripting How to find multiple strings within files under a directory Post 302670375 by Skrynesaver on Thursday 12th of July 2012 04:02:22 AM
Old 07-12-2012
If you want to count the number of lines on which one or more of these strings occur
Code:
for i in $(find /path/to/dir) ; do grep -E '(abc|cde)' ;done | wc -l

If you just want a count of files in which one of the strings occurs
Code:
for i in $(find /path/to/dir) ; do echo $i:$(grep -E '(abc|cde)') ;done |cut -d \: -f1|uniq| wc -l

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find the latest files in multiple directory

I want to get the latest files from multiple directories, d1, d2,d3 and d4 under the parent dierectoy d. can anyone help out with this? thx (3 Replies)
Discussion started by: shyork2001
3 Replies

2. UNIX for Dummies Questions & Answers

best method of replacing multiple strings in multiple files - sed or awk? most simple preferred :)

Hi guys, say I have a few files in a directory (58 text files or somthing) each one contains mulitple strings that I wish to replace with other strings so in these 58 files I'm looking for say the following strings: JAM (replace with BUTTER) BREAD (replace with CRACKER) SCOOP (replace... (19 Replies)
Discussion started by: rich@ardz
19 Replies

3. Shell Programming and Scripting

How to find particular string in multiple files with in the current directory.

Hello friends, Plz suggest the find command, How to search a string in a paticular string in miltiple files with current dirctory.:) Thanks in advance. Siva Ranganath Ch (2 Replies)
Discussion started by: sivaranga001
2 Replies

4. UNIX for Dummies Questions & Answers

grep command to find multiple strings in multiple lines in a file.

I want to search files (basically .cc files) in /xx folder and subfolders. Those files (*.cc files) must contain #include "header.h" AND x() function. I am writing it another way to make it clear, I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies

5. UNIX for Dummies Questions & Answers

Grep multiple strings in multiple files using single command

Hi, I will use below command for grep single string ("osuser" is search string) ex: find . -type f | xarg grep -il osuser but i have one more string "v$session" here i want to grep in which file these two strings are present. any help is appreciated, Thanks in advance. Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies

6. UNIX for Dummies Questions & Answers

how to find and replace strings in multiple files

Hi All, Iam new to unix, I need to find string and replace it in the file name. Like text_123_0.txt,text_123_1.txt,text_123_2.txt. I need to search 123 and replace it with 234 . Is there any unix command to replace them in single command since i have 5 directories. So i need to go each and every... (0 Replies)
Discussion started by: etldeveloper
0 Replies

7. UNIX for Dummies Questions & Answers

Find Multiple Strings from a list of *.gz files withour decompressing...

Hello Team, There is this situation where there are around 20 *.gz files and i want to search multiple words from all those files. Example as below : filea.gz fileb.gz filec.gz now i want to search words "hi" and "hello" from all these 3 files without... (4 Replies)
Discussion started by: varun87
4 Replies

8. Shell Programming and Scripting

Search & Replace: Multiple Strings / Multiple Files

I have a list of files all over a file system e.g. /home/1/foo/bar.x /www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g. if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc. There... (2 Replies)
Discussion started by: spacegoose
2 Replies

9. Shell Programming and Scripting

Grep strings on multiple files and output to multiple files

Hi All, I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results. #!/bin/ksh ( a="/path/file1" b="path/file2" for file in... (4 Replies)
Discussion started by: am24
4 Replies

10. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
COMPILE_ET(1)						      General Commands Manual						     COMPILE_ET(1)

NAME
compile_et - tool for generating com_err error tables SYNOPSIS
compile_et [ --base table_base ] [ --etout out_dir ] [ --stringsout out_strings_dir ] error_table DESCRIPTION
compile_et is a tool to produce com_err style error code to string mappings for use with the com_err error_message() API. compile_et takes the com_err error table file error_table and generates a com_err source and header file for use with add_error_table() and remove_error_table(). It also generates an optional strings file for use with bundled applications. If the contents of the strings file are added to Localizable.strings, then the application does not need to use add_error_table() and remove_error_table(). compile_et is intended to be used by the Kerberos implementation and third party plugins (eg: KLLoginLogoutNotification and KLPrincipal- Translation plugins). OPTIONS
--etout out_dir output source, header and strings files to the directory out_dir. By default compile_et places files in the current working direc- tory. --stringsout out_strings_dir output the strings file to the directory out_strings_dir. By default compile_et places the strings file in out_dir (if it is speci- fied) or the current working directory. --base table_base use table_base as the error table base name. This is a four character code which identifies the error table in the error table database. SEE ALSO
kerberos(1) BUGS
Currently compile_et has no support for generating strings files for multiple localizations. Strings files must be manually localized. COMPILE_ET(1)
All times are GMT -4. The time now is 05:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy