Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find in file. Does this exist under UNIX? Post 96310 by scampsd on Thursday 19th of January 2006 08:52:33 AM
Old 01-19-2006
Find in file. Does this exist under UNIX?

Hello,
I have the following problem. I know there is a file somewhere on a UNIX machine that contains a string, but I don't know where.

With the "grep" command, I can look into a file but only if I'm located in the correct directory.

With the "find" command, I can search across directories but I cannot specify to search within the files for a certain string.

Does there exist a standard UNIX command for looking for a text within a file without knowing the directory in which the file is located?

Thanks
Dominique
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Can Unix Co-Exist with Windows 9X on the same System?

Is it possible to install unix on a system which already runs windows 98? (2 Replies)
Discussion started by: ms73eb
2 Replies

2. Shell Programming and Scripting

how to find a file in UNIX without find command?

given a start directory,a filename,how to find it? (3 Replies)
Discussion started by: bluo
3 Replies

3. UNIX for Advanced & Expert Users

Does UNIX-Chmod in windows exist?

Is there an command in windows to chmod a file to 666 so that when I mount a NAS on solaris, the user can read/write/remove the file from unix server? Traditionally, we invoke ftp from unix to windows, get the file and remove it. With a NAS, can windows chmod the file 666 so that unix can edit... (2 Replies)
Discussion started by: izy100
2 Replies

4. Shell Programming and Scripting

Can I find wether a particular file exist and size greater than zero...help please

Can I find wether a particular file exist and size greater than zero in one line command. similar to this if && something in one if test .... e.g. if 1.) is it possible ? ... if yes how 2.) what would be the return type in case there is success or failure. I mean if both are... (4 Replies)
Discussion started by: guhas
4 Replies

5. UNIX for Dummies Questions & Answers

How to find if file exist in directory using *

Hi, I know how to use the test command ( ...) to find a single given name file. However, I have a case in which I have a directory with one file and one sub-directory. I know that the file starts with "fub". The command doesn't work if i call the file "fub*" as it doesn't understand I meant a... (2 Replies)
Discussion started by: buj
2 Replies

6. Shell Programming and Scripting

Find out whether files exist.

I have the following data stored in a file. 1 /home/file13 /home/file2 2 /home/file41 /home/file654 3 /home/file61 /home/file45 4 /home/file81 /home/file43 ... I want to print the first column provided the files represented by the second and third column exist. How to do that? (3 Replies)
Discussion started by: kevintse
3 Replies

7. Shell Programming and Scripting

find + move if destination path does not exist

hi frnds, please help ... what will happen with below command if destination path does not exist on the system.... find /var/adm/cft* -mtime +1 -exec mv {} /global/ \ in unix its remove all my files from the system from soruce file ... how is it possbile (1 Reply)
Discussion started by: dodasajan
1 Replies

8. Shell Programming and Scripting

Find if a directory exist from a list of the path

Hello, i want to script on sh to check from a path if the directory exist and isn't empty. I explain: path is : /aaa/bbb/ccc/ccc_name/ddd/ Where the cccc_name is in a list, so i think it's $1 My command find -name /aaa/bbb/ccc/$1/ddd/ didn't work because my $1 is the same and not... (5 Replies)
Discussion started by: steiner
5 Replies

9. Shell Programming and Scripting

Find command when there exist many files

I want to run find and wondering if it struggles when there are many files. I have tried and does not seem to complain. Is this correct? (8 Replies)
Discussion started by: kristinu
8 Replies

10. UNIX for Advanced & Expert Users

Isql and If Exist syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (7 Replies)
Discussion started by: Suresh
7 Replies
mcopy(1)						      General Commands Manual							  mcopy(1)

NAME
mcopy - mtools utility to copy DOS files to and from a UNIX operating system SYNOPSIS
mcopy [-mntv] sourcefile targetfile mcopy [-mntv] sourcefile [sourcefiles...] targetdirectory OPTIONS
Preserves the file modification time. Specifies that a warning is not issued when an existing file is specified as the target file. If this option is not specified, the mcopy command verifies whether or not to overwrite an existing file. Specifies a text file transfer. Line terminators are converted to the appropriate format. Specifies verbose mode. The new file name is displayed if the name supplied is invalid. DESCRIPTION
The mcopy command copies the specified file to the named file, or copies multiple files to the named directory. The specified files or directories can be either DOS or UNIX files. If the file is a text file line terminators are converted to the appropriate format. Using a drive letter designation on the DOS files such as 'a:' determines the direction of the transfer. A missing drive designation indi- cates a UNIX file whose path starts in the current directory. DOS subdirectory names that contain the '/' or '' separator are supported. If you use the '' separator or wildcards, you must enclose file names in quotes to protect them from the shell. The mcd command can be used to establish the device and the current working directory (relative to DOS), otherwise the default is A:. Not all UNIX file names are supported in the DOS world. The mcopy command may have to change UNIX names to fit the DOS file name conven- tions. The following table shows some examples of file name conversions: ----------------------------------------------- UNIX name DOS name Reason for the change ----------------------------------------------- thisisatest THISISAT file name too long file.stuff FILE.STU extension too long prn.txt XRN.TXT PRN is a device name .abc X.ABC null file name hot+cold HOTXCOLD illegal character ----------------------------------------------- RESTRICTIONS
The following restrictions exist: Omitting the destination directory is not supported. Using the plus (+) operator is not supported. Using a drive letter designation on DOS files is required with this command only, not with other mtools. EXIT STATUS
The following exit values are returned: Success. Failure. ENVIRONMENT VARIABLES
The following environment variables affect the execution of mcopy: If set, this variable names the file that contains the name of the cur- rent mtools working directory as established by the mcd command. If this variable is not set, the file $HOME/.mcwd is used. FILES
Contains the name of the current mtools working directory as established by the mcd command. If this file does not exist, the default mtools working directory is A:. Executable file SEE ALSO
Commands: dos2unix(1), mcd(1), mdiskcopy(1), mread(1), mtools(1), mwrite(1), unix2dos(1) mcopy(1)
All times are GMT -4. The time now is 07:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy