Sponsored Content
Full Discussion: Find data within file
Top Forums UNIX for Dummies Questions & Answers Find data within file Post 80675 by jim mcnamara on Wednesday 10th of August 2005 04:51:54 PM
Old 08-10-2005
Code:
find /path -name \*.log -exec grep -l "string to find" {} \;

Is the what you mean - look thru loads of files with .log extensions (for example) and get the names of the files with "string to find" in them
 

10 More Discussions You Might Find Interesting

1. HP-UX

find the position in a file and insert the data there

Hi, I have a EDI data file ARROWTEST of size 18246 characters. And I want to insert some data after 4200 position in the file. How I can find the position 4200 in that file....Please advise. Regards, (5 Replies)
Discussion started by: isingh786
5 Replies

2. Programming

to find header in Mp3 file and retrieve data

hi all, In an mp3 file , data is arranged in sequence of header and data ,how to retrieve data between two headers. Is the data between two headers fixed? because as per theory it says 1152 samples will be there , but dont knw how many bits one sample correspond to? it would help if any c... (2 Replies)
Discussion started by: shashi
2 Replies

3. Shell Programming and Scripting

Find lines in text file with certain data in first field

Hi all, Sorry for the title, I was unsure how to word my issue. I'll get right to the issue. In my text file, I need to find all lines with the same data in the first field. Then I need to create a file with the matching lines merged into one. So my original file will look something like... (4 Replies)
Discussion started by: rstev39147
4 Replies

4. Shell Programming and Scripting

C Shell problem: using a key from one file to find data in another

I've never written scripts (just switched from Ada to C++). I have a book that's over my head and a few examples, other then that I'm floundering. Everything here at work is being done in C Shell. None of the C++ programmers are experienced in shell scripting. I have a data file with the... (2 Replies)
Discussion started by: bassmaster
2 Replies

5. Shell Programming and Scripting

Find and replace data in text file with data in same file

OK I will do my best to explain what I need help with. I am trying to format an ldif file so I can import it into Oracle oid. I need the file to look like this example. Keep in mind there are 3000 of these in the file. changetype: modify replace: userpassword dn:... (0 Replies)
Discussion started by: timothyha22
0 Replies

6. Shell Programming and Scripting

Find line number of bad data in large file

Hi Forum. I was trying to search the following scenario on the forum but was not able to. Let's say that I have a very large file that has some bad data in it (for ex: 0.0015 in the 12th column) and I would like to find the line number and remove that particular line. What's the easiest... (3 Replies)
Discussion started by: pchang
3 Replies

7. Shell Programming and Scripting

Shell script to find specific file name and load data

I need help as to how to write a script in Unix for the following: We have 3 servers; The mainframe will FTP them to a folder. In that folder we will need the script to look and see if the specific file name is there and load it to the correct table. Can anyone pls help me out with... (2 Replies)
Discussion started by: msrahman
2 Replies

8. Shell Programming and Scripting

find string(s) in text file and nearby data, export to list help

Hi, So I'm kinda new to shell scripts and the like. I've picked up quite a bit of use from browsing the forums here but ran into a new one that I can't seem to find an answer for. I'm looking to parse/find a string AND the next 15 or so charachters that follow the string within a text file... (1 Reply)
Discussion started by: kar23me
1 Replies

9. Shell Programming and Scripting

Find uncommon in one file from data in another file

Hello, I have 2 files. File A and File B File A has below data 2000328288038 02 <-- its 02 2000292181441 11 2000292181441 11 2000000073963 25 2000075097222 22 File B has below data 2000328288038,2,1234 <-- 2 (it should also be taken care) 2000292181441,11,1233... (2 Replies)
Discussion started by: mirwasim
2 Replies

10. Shell Programming and Scripting

Find Data in test file and write each out to a line

I have a .csv file that has been create from a google form and I need to extract the data from it that has been entered by users. The CSV will have anywhere between 100 and 1000 lines which comprise entr data for a sports carnival A few typical line is shown here to show the problem I have ... (19 Replies)
Discussion started by: kcpoole
19 Replies
Wanted(3pm)						User Contributed Perl Documentation					       Wanted(3pm)

NAME
File::Find::Wanted - More obvious wrapper around File::Find VERSION
Version 1.00 SYNOPSIS
File::Find is a great module, except that it doesn't actually find anything. Its "find()" function walks a directory tree and calls a callback function. Unfortunately, the callback function is deceptively called "wanted", which implies that it should return a boolean saying whether you want the file. That's not how it works. Most of the time you call "find()", you just want to build a list of files. There are other modules that do this for you, most notably Richard Clamp's great File::Find::Rule, but in many cases, it's overkill, and you need to learn a new syntax. With the "find_wanted" function, you supply a callback sub and a list of starting directories, but the sub actually should return a boolean saying whether you want the file in your list or not. To get a list of all files ending in .jpg: my @files = find_wanted( sub { -f && /.jpg$/ }, $dir ); For a list of all directories that are not CVS or .svn: my @files = find_wanted( sub { -d && !/^(CVS|.svn)$/ }, $dir ) ); It's easy, direct, and simple. WHY DO THIS
? The cynical may say "that's just the same as doing this": my @files; find( sub { push @files, $File::Find::name if -f && /.jpg$/ }, $dir ); Sure it is, but File::Find::Wanted makes it more obvious, and saves a line of code. That's worth it to me. I'd like it if find_wanted() made its way into the File::Find distro, but for now, this will do. FUNCTIONS
find_wanted( &wanted, @directories ) Descends through @directories, calling the wanted function as it finds each file. The function returns a list of all the files and directories for which the wanted function returned a true value. This is just a wrapper around "File::Find::find()". See File::Find for details on how to modify its behavior. COPYRIGHT &; LICENSE Copyright 2005-2012 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. perl v5.14.2 2012-06-08 Wanted(3pm)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy