10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to help to work this
Print everything between 2 patterns if grep is not found the search word
example
Detroit
orange
cat
bat
rat
apple
sed -n "/Detroit,/apple/p" d |grep chicago
output would be
Detroit
orange
cat
bat
rat (1 Reply)
Discussion started by: jhonnyrip
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
With grep -ci word * I get a list of files either they have a hit, or the have not (0).
I wanted to pipe to a new list of files, which only shows the files where the string was found, and counted, not the whole bunch.
How to do this?
Any advice welcome!
with best regards,
Omar... (11 Replies)
Discussion started by: OmarKN
11 Replies
3. Shell Programming and Scripting
Hi,
I need to find all rows in 1st col of one file in another file (first occurrence) and replace the 1st col of first file with the grep result (the entire line). For example search AA from file 1 in file 2 and replace in file 1 by entire line found.
File1
AA BB CC DD
BB AA CC DDFile2
... (2 Replies)
Discussion started by: ritakadm
2 Replies
4. Shell Programming and Scripting
Hi,
I need something unusual, I guess. I need to start a process, and if that process displays a specific error message, I need to kill that process and restart it.
Something like:
startprocess | grep -i "This is the specific error message" && kill $pidof(startprocess)
Explanation, I need... (4 Replies)
Discussion started by: burek
4 Replies
5. Shell Programming and Scripting
Hi all,
I've googling around forum regarding my prob, the nearest would same as thread tittled Insert blank line if grep not found, but she/he did not mention the solution, so I would like to request your help
I've this task, to search in file2 based on pattern in file1 and output it to... (4 Replies)
Discussion started by: masterpiece
4 Replies
6. Shell Programming and Scripting
Hi i'm new to the forum and was hoping someone could help me with the following query.
I do alot of testing and have hundreds of log files output. I have a script (someone else wrote) which finds all the passed and failed logs and puts a number in a column onto a webpage:
e.g:
Pass ... (4 Replies)
Discussion started by: defamer
4 Replies
7. Shell Programming and Scripting
Hello Everyone,
i need to read specific number of lines ( always serialized ; i.e from 10 to 20 or from 34 to 44 ) in a file , where the first line is found by grep 'ing a keyword.
example
file.txt
------------------------------------------------------------------
--header
this is the... (7 Replies)
Discussion started by: alain.kazan
7 Replies
8. UNIX for Dummies Questions & Answers
Hello,
How do I use grep to find a pattern in a list of file and then display 5 lines after the pattern is matched
Eg:
I want to match the string GetPresentCode in all files in a folder and then see 4 lines following this match. I am not sure if grep is what should be used to achieve. Thanks!... (3 Replies)
Discussion started by: cv_pan
3 Replies
9. AIX
Lets say I have a file containing string patterns to be looked for inside a file.
I would normaly do :
grep -if MyFilePattern FiletoSearchInto
if I use the -c it gives how many total lines it found out of my whole pattern file, but what if i want grep to report how many times it found each... (4 Replies)
Discussion started by: Browser_ice
4 Replies
10. Shell Programming and Scripting
Hello everyone... please help if you can -- I'm stumped. Making this work will save me hours of manual labor:
I need to search file2 for pattern in file1. If pattern found append file2 line to file3. If pattern not found append a blank line to file3.
file1 contents example:
123
456
789... (6 Replies)
Discussion started by: michieka
6 Replies