10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried:
grep -lr "this string" *
but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies
2. Shell Programming and Scripting
Hello,
I am trying to grep search a pattern and a line before it.
cat input
>record1
hello1hello2hellonhello3
>record2
helloohello1hello2hello3
When I use, grep with -o option and either of -A/B/C options, I still can't see lines before or after the pattern. But the exact pattern is... (5 Replies)
Discussion started by: jacobs.smith
5 Replies
3. Shell Programming and Scripting
Hi,
I've written a script to search for an Oracle ORA- error on a log file, print that line and the .trc file associated with it as well as the dateline of when I assumed the error occured. In most it is the first dateline previous to the error.
Unfortunately, this is not a fool proof script.... (2 Replies)
Discussion started by: newbie_01
2 Replies
4. Shell Programming and Scripting
I was wondering if it was possible to grep a pattern based on the surround text. For example, if i have an input file like this:
titleA
titleB
titlex
titleC
titleD
titlex
titleE
And I want to grep "title" and save the results only if it is not followed with a "titlex". My output... (14 Replies)
Discussion started by: jl487
14 Replies
5. Shell Programming and Scripting
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies
6. Shell Programming and Scripting
Hi,
my xml files looks something like this
<Instance Name="New York">
<Description></Description>
<Instance Name="A">
<Description></Description>
<PropertyValue Key="false" Name="Building A" />
</Instance>
<Instance Name="B">
... (4 Replies)
Discussion started by: tententen
4 Replies
7. Shell Programming and Scripting
hi,
if i have a file and i want to search for the word error using grep, i usually want to see the surrounding lines too as they contain info about the error. what would be a nice way to achieve this?
thanks (6 Replies)
Discussion started by: JamesByars
6 Replies
8. UNIX for Dummies Questions & Answers
I am trying to grep a file and I need to show the schedules that the grep belongs too.
here is the command I am using and the result I am getting:
$ fgrep -e 'SCALHOL' twsschedules
EXCEPT SCALHOL -1 DAYS
EXCEPT SCALHOL -1 DAYS
EXCEPT SCALHOL -1 DAYS
... (1 Reply)
Discussion started by: wereyou
1 Replies
9. Shell Programming and Scripting
Hello the great gurus :)
I'm quite new to this, so perhaps I'm asking a simple and trivial question (which is good, because you'll answer for sure :))))
Anyway. I have an amount of *.c files (about 100), and what I want to do, is to surround a specific function call with #ifdef and #endif.
... (6 Replies)
Discussion started by: xxxaxa
6 Replies
10. UNIX for Dummies Questions & Answers
I would like to be able to grep (or some such thing) a search argument and then display the line plus the preceding 3 lines of the file and the following 3 lines of the file. Any ideas? Thanks in advance! :D (3 Replies)
Discussion started by: robster
3 Replies