how to search a text in all files in a folder in unix

how to search a text in all files in a folder in unix

Hi,

I am using ubuntu and my need is to find all the files containing a text say "India". How Linux users are performing such task?

What is the command that I can run from terminal to find a text in all the files in all directories?

how to search a text in all files in a folder in unix?

Thanks

View Answers

May 15, 2019 at 12:15 AM

Hi,

I Ubuntu or any other linux distribution you can use the grep command to file in files in all directories.

You can use the grep command to find all files containing a given text.

Here is example code:

grep -rn "India"

Above command will find all the file containing this text. I will find in all the files/directories from the current directory.

Thanks









Related Tutorials/Questions & Answers:
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am... terminal to find a text in all the files in all directories? how to search a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am... terminal to find a text in all the files in all directories? how to search a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
Advertisements
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am... terminal to find a text in all the files in all directories? how to search a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am... terminal to find a text in all the files in all directories? how to search a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to read 100 text files from a folder or directory and write the data into a single file.using java programming?
how to read 100 text files from a folder or directory and write the data into a single file.using java programming?  i have multiple(app..100) text files which has data in the form of intgers consisting of 3 columns and app..3000
how to backup files and folder with Java
how to backup files and folder with Java  Does anyone know to create a backup with java?. backup files and folders from my computer to an external...:\\Documents and Settings\\bharat\\Desktop\\bipul\\New Folder\\TableExample.java
how to download the uploaded folder files using jsp
how to download the uploaded folder files using jsp  how to download the uploaded folder files using jsp
PHP listing files in folder
All files, folder   of the given folder can be listed. Function readdir() takes input as the folder handle. Then readdir() returns the name of all the files and folders. Example of PHP Listing Files in Folder
files that are present in any folder , how to make it clickable downloadble file in php
files that are present in any folder , how to make it clickable downloadble file in php   files that are present in any folder , how to make it clickable downloadble file in php
how to upload multiple files in jsp and saving the path in database and the file in folder
how to upload multiple files in jsp and saving the path in database and the file in folder  how to upload multiple files in jsp and saving the path in database and the file in folder I have created a form for the upload of files
How to print differences of two text files
How to print differences of two text files  I have the code to compare 2 different text files, however How can I put the difference of 2 text files in other file or print the difrference in the console?? Thanks
How to Convert Text Files into Gzip File
How to Convert Text Files into Gzip File  Hi, I am developing a small application using PHP language. The real problem is that how do i convert the text files into gzip file. how can i solve the problem.... Tnanks
how to search data in xml files using php
how to search data in xml files using php  So I want to create a website that allows me (or others) to type in a words and select a relevent search... this and how can I use PHP to allow them to search through, and then display
Text Files
Text Files  how to write a text file in the following code: import javax.swing.*; import java.awt.*; /* <applet code = "regdealer.class" height = 400 width =500> </applet> */ public class regdealer extends
How to copy files from one folder to another based on lastmodified date - Java Beginners
Copy files from one folder to another  How to copy files from one folder to another based on lastmodified date
search for particular keyword in the folder documents
search for particular keyword in the folder documents  i am having interface in which i have to enter some keyword through text box and provide path to particular folder. it is a stand alone application so i have to search
in unix which command is used to create files
in unix which command is used to create files  in unix which command is used to create files   The cat command in UNIX can be used to create and display information from a file. Command to create a file % cat >
How to copy files from one folder to another based on lastmodified date - Java Beginners
How to copy files from one folder to another based on lastmodified date  I have to make a simple utility to copy files from a folder to another folder in the same hierarchy, without overwriting the existing.  hiimport
How can I Convert my Image Files to Text Files? - IDE Questions
How can I Convert my Image Files to Text Files?  How can I Convert my Image Files to Text Files
Chmod 777 to a folder and all contents
, subfolders and all files inside the folder permission to 777. The chmod... of a directories.ADS_TO_REPLACE_2 How to Chmod 777 to a folder and all contents? Suppose you...Chmod 777 permission - Chmod 777 to a folder and all contents In this tutorial
Monitor the Folder for the new incoming files - Development process
Monitor the Folder for the new incoming files  to monitor the whole folder for new incoming files ,which the client will place...Monitor the Folder for the new incoming files   Hi,The simplest way to achieve
unix
unix  hai friends, I am new to to java with unix.can you any one tell me ho to work unix in windows xp.i search in net,it will show the aludra.usc.edu.how can i install this? thanks
unix
unix  not able to download java into unix os
Converting Text Files into Bzip File
Converting Text Files into Bzip File  Hi, I am facing the problem during run the program, when converting text files into Bzip file. Please guide me how do i convert the text file into bzip file in PHP. I will welcome, if anyone
Converting the text files into gzip file.
Converting text file into gzip file This example will explain you how to convert text files into gzip file. Under gzip operation, first text files... text file into gzip and write gzip and read gzip file operation $filecompress
ModuleNotFoundError: No module named 'search_in_files'
named 'search_in_files' How to remove the ModuleNotFoundError: No module named 'search_in_files' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'search_in_files'  Hi, My
Full-text Search
Full-text Search  I need a java source code to impliment a full-text search in java web application using servlets with firebird database
Full-text Search
Full-text Search  I need a java source code to impliment a full-text search in java web application using servlets with firebird database
Java search text file
Java search text file In this tutorial, you will learn how to search a text... the name of a text file to search for. If the name does not have a .txt extension, display an error message. Then search the file in the current directory
how to download a file from a folder??
how to download a file from a folder??  i can upload any kind of files to a folder, and only the path of the file is saved into the database, now how a client can download the file from my folder. pls provide me the jsp code
save output in multiple text files
save output in multiple text files  Hi..I'm getting problem to store the output of this php code into multiple text files. Can anyone sugeest. Here is my code: <?php for($i=1; $i<=100; $i++) { $html = file_get
How to create a new text file that contains the file names of the copied files in a new directory? - Java Beginners
How to create a new text file that contains the file names of the copied files in a new directory?  Okay so my question is: How to create a new text... text file that has the file names of those files that I copied in a list
how to set folder size in php
how to set folder size in php  hi , i know how to create folder but i dont know how to set size for folder did u know means tell me. thankyour
unix
unix  Write a program lc[1] which takes a file name as its sole argument and prints out how many lines the file contains. An example execution of this program might look as follows: $ java lc lc.java 20
Java Util Zip. Zip files/folders inside a folder, without zipping the original source folder.
Java Util Zip. Zip files/folders inside a folder, without zipping the original source folder.   import java.io.File; import... the method a very static scenario. I want to take the files inside the folder
How to make a folder icon, make a folder icon, folder icon
How to make a folder icon       The folder is used in the computer, this example will teach you to design technique of the folder.  New File: Take a new file as your folder
Creat a folder, inside it upload and download files in jsp and mysql
Creat a folder, inside it upload and download files in jsp and mysql  Create one or more folder .inside it we can upload and download multiple files... to database. The uploaded files will then displayed on the browser and will allow the user
Java search word from text file
Java search word from text file In this tutorial, you will learn how to search a word from text file and display data related to that word. Here, we have created a text file student.txt which consists of id, name and marks of few
how to browse folder and directory in jsp
how to browse folder and directory in jsp  how to browse folder and directory in my jsp page.i have done my coding part for browsing directory but dont know how to get files after that.and also i want to show limited directories
Zip Folder Using Java
; In this example we are going to create a zip folder and all files contained in this folder are zipped by using java. Here we will learn how to compress files... of all files of folders. The list() method is used to find list of files in a folder
Search and return lines of text file
Search and return lines of text file  I wrote the following code, that found lines of txt file with contains certain word, but it returns only the first or the last line! (However, the System.out.println show me all the lines
Normalize All of the Text in a Document
Normalize All of the Text in a Document       This Example describes a method to Normalize all...():-it normalize All of the Text in a Document Xml code for the program generated is:-ADS
Converting the text files into bzip file.
Converting text  file into bzip file In this example, you will see, how to convert a text file into bzip file. In this example, we have printed 'I am a good programmer' along with converting a file into bzip file.  Opne the PHP
indexing pdf files with hibenate search - Hibernate
indexing pdf files with hibenate search  hello, I am trying to index pdf files to search with hibernate but I can not manage it. do you have a sample? thank you
binary search tree from text file
binary search tree from text file  How so I go about constructing a binary search tree from a text file, which has letters and numbers, which must be sorted and printed in ascending order. E.g. Text file contents 3 apples pears
How I Choose a folder - Java Interview Questions
do not explain clearly my question. I know how I get files from a folder. My question How I select a folder. From this selected folder i get the files. I know how I get files but the problem How I choose a folder. Thanks
How to make a cloudy text, cloudy text, text
How to make a cloudy text       You all have seen the cloudy sky. Have you ever tried... to do that.  After this you will able to make a cloudy text. Here
how to read the values for text and csv files and store those values into database in multiple rows..means one value for one row
how to read the values for text and csv files and store those values... a program by using servlets.. the program is like this i upload a text and csv... namelist(name varchar(20)); Required files 1. uploadform.jsp 2. Upload.java
PHP list all files
All files, directories of the given directory can be listed. function readdir() takes input as the directory handle. Then readdir() returns the name of all the files and directories. PHP List All Files Example <?php  
How to copy an jpeg image from one folder to other folder using jsp
How to copy an jpeg image from one folder to other folder using jsp  How to copy an image from one folder to another folder using jsp

Ads