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


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

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 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

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 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

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 :: 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

Ubuntu :: Bash Script To Delete/replace A Specific String Of Text?

Jun 17, 2010

What i want to do is pretty simple.I want to uncomment every line that begins with "deb" (except for deb cdrom) in /etc/apt/sources.list.I know how to do this through system > administration > software sources.I know I can gksu gedit /etc/apt/sources.list.I'd rather not do it that way.I'd rather have a script do it. It's less work, less typing, less clicking, and would work the same on every ubuntu version.

View 8 Replies View Related

General :: Recursive Search For Files That Hold Some Specific Text?

Jan 18, 2011

How do I recursively generate a text file which has a list of all files on my server which contain a specific string anywhere in the files?

I know the following command can be used to replace a string recursively

find /var/www -type f -print0 | xargs -0 sed -i 's/old string/new string/g'

I do not want to replace the string, I just want a list of all files which contain the string.

View 4 Replies View Related

General :: Find A String In Files Under The Current Directory?

Oct 5, 2010

Assumed y directory structure looks as follow:

Code:
--root
-- dir1
-- dir1-1

[code]....

And under each sub dir there are some log files ended with .log. Now I know how to list all these log files with:

Code:

find . -type f -name "*.log"

Assumed now there is a string called "Hello World" inside some of these files. How can I find out these files? I try followings but failed

Code:

grep "This is" | find . -mtime 0 -type f -name "*.log"

View 4 Replies View Related

General :: Parse A Particular String In Files In Particular Directory And Its Sub-directories?

May 4, 2010

I want linux command to parse a particular string or pattern in files that are in my home directory and its sub-directory.

View 4 Replies View Related

General :: Find All Files Starting With A String Lsnr* Under Root Directory

Oct 31, 2010

I am looking for Windows Search equivalent looking for file name patterns (not file contents but file names)....

I am aware of "globbing" and wildcard recursive search functionality in ls but I am still not capable of finding files under directories.

for example: I want to find all files starting with a string lsnr* under root directory / and any sub-directories.....

ie I want to look for files like lsnr*.* anywhere under / and any sub-directories under / such as /dir1/dir2/dir4 and dir1/other/dir/someotherdir/sub-dir etc.

so if I have /dir1/lsnrcontrol and also have /dir1/dir/2/dir3/lsnr-tinit.dat then I want to list the files names etc.

how to do this using ls -R and wildcards.

View 1 Replies View Related

General :: Use Sed To Edit String In Multiple Files Not Contained In Current Directory?

Apr 7, 2011

I have the following problem:

CASE_FOLDER
----------->0_FOLDER
-------------------->ForceX ForceY ForceZ

[code]...

View 1 Replies View Related

General :: Xargs And Unzip All Files To Specific Directory?

Jun 22, 2009

I'm trying to find all zip files timestamped from the past 7 days, then unzip them into a different director.I tried the following, but it only unzipped one of three files that meet the 7 day criteria. What am I missing?Code:find /home/user/public_html/zip_files/ -iname "*.zip" -mtime -7 -print0 | xargs -n10 unzip -LL -o -d /home/user/public_html/another_directory/

View 1 Replies View Related

General :: Forbid Removal Of Files But Allow Creation Of Them For Specific Directory?

Jun 14, 2010

I have an application that creates temp files and quickly deletes them. But I'd like to keep those files, is there a way to do that in Linux?

View 2 Replies View Related

General :: Overwriting Specific Files In Directory Tree Recursively

Jul 19, 2011

I would like to overwrite files in a directory tree, recursively. The ones I would like to overwrite match the filename "x_alpha*.png" and have a size exactly 456 bytes. Is there any way to search for these recursively in a directory tree, and overwrite them with a reference file, for example "e:mydirgood.png"

I am using Windows 7, but I have UnxUtils, so I can use those too. What I am looking for is something like this, generated automatically:
copy /y e:mydirgood.png e:mydiracx_alpha0023.png
copy /y e:mydirgood.png e:mydirefgx_alpha0045.png
copy /y e:mydirgood.png e:mydirhx_alpha0248.png

View 2 Replies View Related

General :: Find Files With Specific Extension And Move To A Directory?

Apr 18, 2011

I need little help. I want to find all files with extension "*.tar" "*.gz" and "*.zip" and move all those files into "/opt/old" directory. I've tried this command:

Quote:

find . -type f -name "*.tar" "*.gz" "*.zip" -print0 | xargs -0 -r mv /opt/test

It's not working, something wrong after "mv" i guess.

View 10 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

Ubuntu :: Searching WITHIN Doc - Xls - Ppt Files - Grep Is Unable To Locate Text INSIDE File Types

Sep 1, 2011

I am on Ubuntu 11.04 and using Libre Office 3.3.2 to compose new documents and am saving them using .doc, .ppt and .xls files. (due to having to share them with others who are on Windows systems)

I have a lot of doc files and I need to search for text INSIDE these files. I am perplexed with the fact that no search tool is able to search for text INSIDE these file types. "cat" can display them of course, but grep is not able to locate text INSIDE these file types. I even tried to save a .doc file as an .odt file, but no luck. The Applications>Accessories>Search for Files does not search INSIDE doc, xls or ppt with the option "Contains the text".

View 6 Replies View Related

General :: Making Specific Script Loop Over Multiple Files In Directory?

May 10, 2011

I am trying - to no avail - to take an old script I found in the forum help-needed-in-grep-for-tar-gz-658730/ The code:

Code:
#!/bin/bash
if zgrep $1 $2 > /dev/null 2>&1

[code]....

View 3 Replies View Related

Software :: Check The Contents Of A Text File For A Specific String And Remove It From The File From The Command Prompt?

Oct 14, 2010

I want to be able to check the contents of a text file for a specific string and remove it from the file from the command prompt. I would basically be searching through a number of files and if a specific string is found I would like it removed automatically. pretty much a find and replace, were the replace is nothing. any one got any ideas on how you would do this. I already have the search part sorted just need to be able to remove the string I don't want from the multiple files.

View 4 Replies View Related

General :: Change A Specific Characters To Capital In A Specific Text?

Dec 2, 2010

for example

else {
for fileDOC in $location/*.doc
do

[code]...

View 12 Replies View Related

Software :: Find And Delete String In Text Files?

Mar 6, 2010

I have a series of file names in a text file that I generated by running
Code:

bash-4.1# ls -alt *.txz | awk '{print $8}'
and then copy pasting the output. All of these file names have the version number
Quote:
-4.4.1-x86_64-1alien.txz

I just want a method to remove that version number from all the filenames so that I can then add all the packages without version numbers to a blacklist file.

I've tried kwrite and mousepad and both have a search feature and a replace feature but I haven't been able to just have the text removed successfully.

View 3 Replies View Related

Programming :: C - Put A Specific Arbitrary Part Of A String Into It's Own String?

Apr 18, 2010

So if I'm given a location of a file like:

How can I just take the type of the file at the end? I know I can use strrchr() for a period to get the pointer to the period just before file type. Is there a build in string function that will just take the rest of the string from a certain point on forward in the string? I know it wouldn't be much work to make it myself, but I figured I would find out if it already existed before doing it.

View 9 Replies View Related

General :: Delete A Specific String In Vi?

Sep 16, 2009

How do i delete a specific string in vi? Suppose i want to delete only the instance "ing" occuring in a file through vi , how could i do this??

View 3 Replies View Related

Software :: Replace A Text String In A File With A Random String - With Sed ?

Sep 2, 2010

I have a line in a text file that has 40 random characters within a tag and i want to change the characters to a new set of 40 random characters (alphanumeric a-z 0-9 etc)

The line in the text file looks like this:

Quote:

How would i go about doing that?

Also second question same as the above but how would i remove them instead of replacing them?

View 14 Replies View Related

General :: LS Hangs On Searching For Filename In Directory

Oct 19, 2010

I have a directory that has a large number of files, around 1.5 million at this point. If I go to the directory and type in "ls filename" for a filename that I know exists, ls just hangs. I have let it run for over 20 minutes and it never does anything. Up until yesterday the directory was working fine through samba serving up files, but now it doesn't return anything. How to proceed from here?

View 7 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







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