IMHO I think you are looking for grep -l option, since it will only print Filenames which have that specific text in them, try something like:
In my tested case output was as follows.
In above code change /tmp/ with your actual/complete path details and it should provide it in your output. Also I have kept 2>/dev/null for removing Errors its up to you in case you want to see errors on screen.
From man page of grep:
Quote:
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the
first match.
Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
Hi,
I need to find out a particular pattern from a directory, for example say X.
The X directory contains 10 c files, and it has subdirectory called Y, and Y has 20 c files within it.
Now I have to find out the pattern only from parent directory X not from sub directory Y.
I have... (4 Replies)
I have some patterns that I need to match with the content of several files and I'm having trouble to do it
Here is what I tried already :
ksh won't even execute this
#!/bin/ksh
path="/export/home/ipomwbas"
pattern=$path"/flags"
find . -name "*.properties" |\
while read file; do
... (7 Replies)
Hey, I have a question about using grep and find together to locate all C programs in a directory containing certain words and open the vi editor with each file. I'm not sure how to do this in one command (as in one line). I know find has a "-exec" option that can call vi, but how do you combine... (1 Reply)
HI
what is the difference between find and grep
if I want to find all the files from different directories which contain "ORA" error, and the line number in each file which has ORA error
should I use pipeline ?
thanks
James (3 Replies)
Hey,
I have a Find command like:
find $searchDir -type f
and this returns a list of files under the directory, which is all good, but, I want to filter that search for files that contain the string "people"
I tried something like:
find $searchDir -type f -exec grep "people" '{}'... (2 Replies)
:wall:Hello, Im having trouble using the find and grep combined into one command. I have the following:
find filname* -mmin -60 grep "ERROR" filename
I want to find the "ERROR" text in any file created in the last hour in the current directory. I dont know how to end the command. If I leave... (3 Replies)
I have a file called 'test.txt' that contains alphanumeric charecters.
The file contains the word 'SBE' followed by other alphabets many times. For example, the file will contain: SBE334GH and also will have SBE77Y8I.
When i do grep 'SBE*' test.txt - it outputs the entire file.
Can you... (5 Replies)
Hi all ,
I'm new to unix
I have a checked project , there exists a file called xxx.config .
now my task is to find all the files in the checked out project which references to this xxx.config file.
how do i use grep or find command . (2 Replies)
How can I recursively find all files in a directory and print out the file and first line number of any text blocks that match the below cases?
This would seem to involve find, xargs, *grep, regex, etc.
In summary, I want to find so-called empty "try-catch blocks" that do not contain code... (0 Replies)
Is it possible with find and Grep to search files under a directory and display only files that have multiple occurrence of a string (In AIX)? Anybody has an example code? If not what are the other options?
Thanks in advance. (7 Replies)
Discussion started by: J_ang
7 Replies
LEARN ABOUT ULTRIX
edit
ex(1) General Commands Manual ex(1)Name
ex, edit - text editor
Syntax
ex [ - ] [ -v ] [ -x ] [ -t tag ] [ -r ] [ +command ] [ -l ] name...
edit [ ex options ]
Description
The editor is the root of a family of editors: and The editor is a superset of with the most notable extension being a display-editing
facility. Display-based editing is the focus of
The name argument indicates the files to be edited.
Options
- Suppresses all interactive-user feedback. This option is useful in processing editor scripts in command files.
-v Equivalent to using rather than
-t Equivalent to an initial tag command, that is, editing the file containing the tag and positioning the editor at its definition.
-r Used to recover after an editor or system crash. It recovers by retrieving the last saved version of the named file. If no file is
specified, it displays a list of saved files.
-R Sets the read-only option at the start.
+command
Indicates that the editor should begin by executing the specified command. If the command is omitted, it defaults to $, positioning
the editor at the last line of the first file, initially. Other useful commands here are scanning patterns of the form +/pattern or
line numbers.
-l Sets up for LISP. That is, it sets the showmatch and lisp options. The -x option is available only if the Encryption layered product
is installed.
-x Causes to prompt for a key. The key is used to encrypt and decrypt the contents of the file. If the file contents have been encrypted
with one key, you must use the same key to decrypt them.
Restrictions
The command causes all marks to be lost on lines changed and then restored if the marked lines were changed.
The command does not clear the buffer modified condition.
The z command prints a number of logical rather than physical lines. More than a screenful of output may result if long lines are present.
File input/output errors do not print a name if the command line minus sign (-) option is used.
There is no easy way to do a single scan ignoring case.
The editor does not warn you if you place text in named buffers and do not use it before exiting the editor.
Null characters are discarded from input files, and cannot appear in output files.
Files
/usr/lib/ex?.?recover recover command
/usr/lib/ex?.?preserve preserve command
/etc/termcap terminal capabilities
~/.exrc editor startup file
/tmp/Exnnnnn editor temporary
/tmp/Rxnnnnn named buffer temporary
/usr/preserve preservation directory
See Alsoawk(1), ed(1), grep(1), sed(1), vi(1), termcap(5), environ(7)
"Edit: A Tutorial" and the "Ex Reference Manual" in the
Supplementary Documents, Volume 1: General User
ex(1)