General :: Searching A Particular String In All Files Of A Single Folder?

Jun 27, 2011

I just want to know if we can search for a particular string in all files of a particular folder in linux. if a folder has 100files only that hundred files needs to be checked for a particular string.

View 5 Replies


ADVERTISEMENT

General :: Searching For Text String In All Files?

Mar 3, 2011

Is it possible to search ALL files on a system for a specific text string? I've been messing around with grep without any luck.

View 2 Replies View Related

Ubuntu :: Sed - Searching Single And Double Quote Chars In Text String

Oct 27, 2010

I need sed to be able to search a string that includes both single quotes (') and double quotes ("). can anyone help me out, there has to be a way to do this.

So far I have tried:

But none of these work and I cannot think of how else to escape the sed quote inside of brackets.

View 3 Replies View Related

General :: Searching A Specific Directory For Files Containing A Text String?

Nov 20, 2010

I am a member of a group which has written a program whose source code is being held in a specific directory (~cs252/Assignments/basicAsst/project) and we want to go through and change the parameters for the function "sequentialInsert." My job is to find all occurances of the function call to "sequentialInsert" and to also list the files from where the code came from. Also, I have to be in the commandsAsst directory when I do this. I have tried grep and find combined together, and I am at a lost.

View 1 Replies View Related

General :: Getting Segmention Fault Error While Searching String In Csv File?

Jan 18, 2011

I am using grep command to search in a particular file whose size is 11 GB and i am getting Segmentation fault error as an output. My command and output is as follows:

Code:

[sdpuser@gnnsdp40 test]$ cat new* | grep 8858406465
Segmentation fault

My linux version is as follows:

Code:

[sdpuser@gnnsdp40 test]$ uname -a Linux gnnsdp40 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

how i can parse the complete file for searching string. I have also used split command of linux which splits the file of 11 GB to 11 files of 1 GB each respectively. But still getting the same "Segmentation fault" error while using grep.

View 9 Replies View Related

Programming :: Using Sed Replace Line Containing Particular String By A Single String?

Oct 16, 2010

I have a set of lines as ahown below:

Leon went to school
Leon came back from school..
Leon had dinner...

I have to replace the line containing "dinner" by a single string LUNCH...

View 2 Replies View Related

General :: Command For Searching A Folder?

Nov 29, 2010

I have searched a lot in google regarding the various search commands available for linux, but everywhere i got the commands only for files. But suppose i know the name of a folder but not it's path, then what is the command to search for it's path.

View 10 Replies View Related

Ubuntu :: File Manager Crashes When 20000+ Files In Single Folder?

Dec 19, 2010

why the file manager, nautilus is it called? can't cope with folders with extremely large numbers of files in it, is there a fix? if not could be a future project for future distributions, i have some folders with 20, 000+ files in it, for rendering fractal animations, i am trying to free up some room, the trash can can't empty it from trash because there are so many files, and when i try to open the folder, it crashes and restarts completely

View 1 Replies View Related

Red Hat / Fedora :: Searching And Comparing The String

May 18, 2010

I have a file which provide the output of all the applications which started and running successfully. But it doesn't give the Error message of the applications which are failed. For example there are 5 applications (ABC,DEF,NMO,STO,XYZ) and application STO failed so I will get the following output (out.txt). content of out.txt file

Application ABC is Running
Application DEF is Running
Application NMO is Running
Application XYZ is Running

I want to generate the text message based on the information on out.txt that STO application is Failed.

View 2 Replies View Related

Ubuntu Servers :: Terminal Command - Searching Given SH File For String

Mar 10, 2010

I need a hand with a line of terminal commands. I need to be able to search a given .sh file in a given location for a string, and when found, add a "#" to the start of that string and save the file back to it's original location.

View 1 Replies View Related

General :: String Replace In Filenames - Files Already Contain The String "Soundtrack"

Jun 11, 2011

Moving right along, I have a folder of MP3 files containing various Movie sound tracks and scores. I'm using Audio Tag Tool to tag all the files at once with an "Artist" of "Soundtrack", and to inherit the "Title" tag from the file name. After that, I will rename all the files (Using Audio Tag Tool -- awesome program, btw) with the format "<Artist> - <Title>.mp3"

The problem, is many of my files already contain the string "Soundtrack", which would be redundant. I happen to be a perfectionist, so I'm unable to ignore it and move on. Hence my question to you fine folk: I want to delete all instances of "soundtrack" (-i case irrelevant) in the filenames before I go through the above steps. But, its not quite that simple. This is a sample of some of the file names:

[Code]....

View 3 Replies View Related

General :: How To Rename Everything Matching Certain String In Folder

May 19, 2010

I am running Linux and I have some basic console knowledge but my current problem is quite difficult and I dont know how to achieve this. I want/need to rename everything within a folder that matches a given string.

By everything I mean:
folders/files
content within a file
content in hidden files

Basically I want to refactor a Java-project. Sure, I could use Eclipse to handle the replacing, but this leaves out the folders or resources outside of my workspace. I was thinking of a script that could do the job for me but this seems rather tricky. For instance when it comes to folder-/file-rename I want to replace only the part of the name that matches my string, the rest should remain untouched.

View 2 Replies View Related

General :: Searching For PHP Files With Find And Grep

Nov 2, 2010

I am looking for all the files that contain the text string 'moo.sql'. I ran the following:

find . -name '*.php' | grep -lir 'moo.sql' *

Unfortunately it seems to return non-php files in addition to php files. I thought the find portion of this would filter the file names so grep would only search php files.

View 3 Replies View Related

General :: Recursively Searching PHP Or HTML Files

May 5, 2010

I'm a frequent user of grep. I know that I can recursively search a directory using the -r flag:
Code:
// will recursively search all files
grep -r 'some string' *

However, if I want to limit my search to PHP files, the -r flag is suddenly useless:
Code:
// for some reason, this only searches the PHP files in the current dir
grep -r 'some string' *.php

Any good way to recursively search a directory and its subdirs for a string but ONLY look at PHP or HTML files (and possibly TXT files too) ? I'm really hoping for a nice, short command that doesn't involve using an exclude file and which isn't really painful to type. I do this kind of search very frequently and have resorted to either searching EVERY file which is really slow (TAR and ZIP files really slow it down) OR typing repeated commands to search *.php, */*.php, etc.

View 6 Replies View Related

General :: Searching Files For Specific Words Or Phrases

Jan 31, 2011

I have word like initialize_my_var:in sample.php and I included three library files, take it as a.php, b.php, c.php ,I really don't know where my label(initialize_my_var:)definition is present in my library files, is it possible with a pattern matching string to find which library file really have the exact term "initialize_my_var:" , I'm really looking for an exact pattern match.

View 1 Replies View Related

General :: Script To Copy Some Files With Ftp After Searching In The Directory?

Apr 20, 2011

I was trying to develop a script which needs to check the count of files on hourly basis and if it find any addition it has to sftp and send a email on the status with filenames and number of files copied via sftp. I will put it on cron to run every hour.

I'll use ls /abc|wc -l to count the no. of lines for the first time and from then whenever a new file will be inserted it'll copy that file to another location or I'll take the date of the files and whichever is having a new date that will be copied to another location.

View 7 Replies View Related

General :: Recursive Searching Files In Directory Matching Given Name?

Apr 16, 2010

I am writing a shell script that finds all files named <myFile> in a directory <dir> or any of its subdirectories, recursively. I also need to take care of symbolic links that may form cycles, to avoid infinite loops. I am not supposed to use find command for the same

I started writing the code but got stuck. I thought using recursion may be a smart way, but its not working.

Code:
#!/bin/sh
findFiles()
{
thisDIR=$1
#cd $thisDIR
code....

View 5 Replies View Related

General :: Searching Text Files For Large Numbers?

Dec 31, 2010

I am looking for a way to search for large numbers in text files and print the nearby lines.

For example if I had a text file like:

Event: 11
blah: 3
blah: 41 bleh: 19
Event: 2
blah: 31

[Code].....

View 1 Replies View Related

Programming :: Retrieve A Single String Or Value From /proc/cpuinfo

Oct 1, 2010

I'm trying to retrieve a single string or value from /proc/cpuinfo, but when I try to extract the model (not the model name) the model name comes with it, also it likes to print it twice...

Code:
model="`cat /proc/cpuinfo | grep model | cut -d: -f2 | cut -c1-3`"
echo $model

All i want this to do is spit out the model number once. (I need to pass it to another script)

View 14 Replies View Related

Programming :: Python - String To Omit The Single Quotes (')?

Mar 18, 2011

After I assign a string to a variable, I know that the print function will remove the single quotes around the value, but is there a way to assign a variable without the quotes around the value? for example:

a = open('/usr/lib', 'r+')
b = f.read()
c = x.replace('.xx','yy')
d = ?

c returns the value with quotes around it print c returns the value without the quotes Is there a way to assign a new variable (d) which will equal c without the quotes? I need a new variable which has the quotes omitted because from there the script will take the value of the last variable (which is a path to a file), and tar up that file. It won't recognize the path to the file if the value has quotes around it.

View 1 Replies View Related

General :: List Folder Size And Number Of Files And Folders In Folder?

Nov 23, 2010

In Linux bash shell, for a given directory, how can I list:The create date for that directory The number of files in that directory The number of subdirectories in that directory.

View 3 Replies View Related

General :: Copying All .jpg Or .JPG Files From A Folder And All Its Subfolders To /usr/name/pictures Folder?

Sep 10, 2009

How would i go about copying all .jpg or .JPG files from a folder and all its subfolders to my /usr/name/pictures folder? I'm guessing I'd have to use some sort of .[jJ][pP][gG] to get all the pictures from other examples i've seen, but really not sure how to use that in a recursive cp.

View 14 Replies View Related

General :: Copy Files From One Folder To Another Folder Using Shell?

Mar 4, 2010

i need to copy files from a folder called output files to another folder called running but im not able to do it i always get a stat error

View 14 Replies View Related

Programming :: String Editing: Remove Lines Consisting Of A Single Character?

Jul 16, 2010

I have a large text file that's formatted sort of like this:

Code:
foo bar
blah

[code]...

View 2 Replies View Related

General :: Search For String In New Files?

Jul 4, 2010

I would like a command or a bash script that search all files in all sub, modified last 12 hours, in /var/logs and that contains "alfa" or "bravo". The output should be filename of the file or files that contains that.

View 3 Replies View Related

General :: Listing Files Whose Contain A String?

May 5, 2010

following can be used to locate files that contain the contents 'SomeString' or 'SomeOtherString':

Code:

find /home/username/public_html -type f -print0 | xargs -0 egrep -l 'SomeString|SomeOtherString'

How would I limit this to searching for the text 'SomeString' or 'SomeOtherString', but only if the file has extension .php, .inc or .js? Also - what piping to xargs does here? I don't understand how this command actually works.

View 3 Replies View Related

General :: Remove All The Files Which Has A String In A File?

May 8, 2010

I am trying to remove all the files in a directory hierarchy which a certain string inside the file (not the file name, it is the file content).

I can list out all the file name which has a string in the file using 'grep -r -l mystringlooking for'.

But how can I remove all the files returned by the grep ? I am trying this on ubuntu.

View 1 Replies View Related

General :: Remove Files That Contain A Specific String?

Feb 17, 2010

How can you remove files containing a specific string?I have...Code:find |grep 'string'This may return several results and I wanted to rm the results.I also have...Code:ls -l |grep 'string'|awk '{print $9}'which also may return results.But point is, I can't supply the results as a parameter to rmI was thinking of looping but I don't know how to access the results as if they were an array or something.

View 5 Replies View Related

General :: Recursive String-search In Files?

Oct 28, 2009

find out a command to search among all *.dat files in a certain path (including subdirectories) looking for the following text in them:

Code:

--------------------------------------------------------------------------------
Elements with small area
Element Adjusted nodes
--------- --------------
16294 NO
17889 NO

and getting the list of elements with small area printed in a file "ErrorEl.txt". The output should have this form:

"/path/01/A.dat
bad-el#01
bad-el#02

[code]....

I know already how to find out the dat files containg a certain string

Code:

c=/path/
grep -R --include="*.dat" "Elements with small area" $c | cut -d: -f1>> ErrorEl.txt

but I don't know then how to get the element numbers(16294 and 17889 in the example above)

View 11 Replies View Related

General :: Keep Chmod On Folder / Sub-folder And Files?

Nov 3, 2010

I got a folder that I transfer stuff to all the time. the folder is in chmod 775 but when i upload folders and files, they are given chmod 700, but i want it chmod 775 everytime i upload something. so far i have logged in to my linux computer and did a chmod -R 775 to the folder every time i uploaded something to it. is there a function somewhere to make it 775 everytime i upload or can i have something run a script, so i don't have to go in and write it everytime i upload something?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved