How do I get it to do a ls -l on the list of files? I tried doing
and that does not work. The command just hangs there.
Yep, but try this:
The option -print, instead of -print0, can easily lead to errors. You pipe the output to grep. What if you have a file with a space in its name, for example?
Besides, I don't understand very well why you're using
instead of:
So, putting all toghether, I'd try:
Hello,
Perhaps someone here can help with this. I'd like to grep a plain text file for a word and output each line containing a word found to a seperate line instead of back to back.
Examples:
Basic command:
cat file.txt > grep -i CAT > results.txt
file.txt:
The cat said meow
The... (7 Replies)
I need help to further reduce the output shown below. I want to be able to only return the paragraph where the 'Database alias' is exactly equal to DBIHP. I do not want the other paragraphs being shown below.
$ echo $dbalias
DBIHP
$ db2 list db directory|grep -p 'Database alias ... (2 Replies)
Hi
I need to search for matching strings in a database and I want to print out all files that matches in "detail", which means that I want the output to contain datum of last saving. I only get the grep function tp print the actual file names which is not enough since the database is to large... (14 Replies)
Hi,
I am currently reading a tar file and searching for a particular word using grep e.g. Plane. At the moment, if a sentence is found with the word "Plane" the sentence itself is piped to another file.
Here is the code i am using;
for jar in 'cat jar_file.tar'; do
tar -tvf... (3 Replies)
Here is one I am baffled with; I have not used unix for a while and now that I am back it has been fun remembering and I have enjoyed it, for the most past. this is in ksh.
I need to search in a file for the line with X1 and cut columns 20-25, put them into a variable, added them (dollar... (3 Replies)
Hello guys,
I have been looking around but can't find the answer to my problem:
If the grep command displays no results, print "no results have been found" and increment x. But if the grep command find something, do nothing.
if
echo "no results have been found $x"
x=`expr $x + 1 `... (3 Replies)
Hi all,
I'm working with a peice of software that runs on Linux that allows planning trips in cars through maps. This software has different variations depending on the type of car, e.g. BMW, Audi, Hyundai, etc... Each variation has a dependency on common external components that are not... (1 Reply)
hi,
let's say we have input in files test1.txt, test2.txt, text3.txt ... ... ... ('...' means more files & lines not just 'dots')
test1.txt has:
A
B
C
D
...
...
...
test2.txt has
A
B
C
D
...
...
... (4 Replies)
Hi,
i have a file hello.log which as several line that look like the below
2015-12-07 09:46:56 0:339 120.111.12.12 POST /helloWorld
2015-12-07 09:46:57 0:439 122.111.12.12 POST /helloWorld
....
when i grep expecting to see results like the below.
... (6 Replies)
Discussion started by: mohtashims
6 Replies
LEARN ABOUT SUNOS
gzegrep
GZGREP(1) General Commands Manual GZGREP(1)NAME
gzgrep, gzegrep, gzfgrep - search possibly compressed files for a regular expression
SYNOPSIS
gzgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
gzgrep is used to invoke the grep on compress'ed or gzip'ed files. All options specified are passed directly to grep. If no file is speci-
fied, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and
fed to grep.
If gzgrep is invoked as gzegrep or gzfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, gzgrep
uses it as the grep program to be invoked. For example:
for sh: GREP=fgrep gzgrep string files
for csh: (setenv GREP fgrep; gzgrep string files)
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO grep(1), egrep(1), fgrep(1), gzdiff(1), gzmore(1), gznew(1), gzforce(1), gzip(1), gzexe(1)ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWgzip |
+--------------------+-----------------+
|Interface Stability | External |
+--------------------+-----------------+
NOTES
Source for gzip is available in the SUNWgzipS package.
GZGREP(1)