I want to write a script, with these arguments:
- the pattern to find in a file (that is text)
- the path where the files to analyse are located
- the minimum and the maximum n° of times the pattern is found.
I know how to handle the arguments, but I don't know how to do the "core" of the script, the part of script where I write the command using grep (or other command) in pipeline with all other command are needed.
The most difficult part of the script is that one in Bold.
what I have written is:
but it does't work
PS: I don't speeck english very well, so please be patient.
I have this fileA
TEST FILE ABC
this file contains ABC;
TEST FILE DGHT this file contains DGHT;
TEST FILE 123
this file contains ABC,
this file contains DEF,
this file contains XYZ,
this file contains KLM
I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
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)
I have two files file1.txt and file2.txt. Please see the attachments.
In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported
Input file is a free flowing file without any format
example of output
ERR-99999=10 (4 Replies)
I am trying to extract the values ( text between the xml tags) based on the Order Number.
here is the sample input
<?xml version="1.0" encoding="UTF-8"?>
... (13 Replies)
I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
in a file I have this.
if i find feedthru_pin want to insert !! at the... (7 Replies)
I think you ppl did not get my question correctly, let me explain
I have 1.txt with following entries as shown:
In file 2.txt I have the following entries as shown:
... (1 Reply)
I am new to this forum and i would like to get help in this issue.
I have a file 1.txt as shown:
Now i would like to search for pattern say apple or orange and then put a # at the beginning of the pattern... (2 Replies)
I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in)
This is on solaris
Can you help? (2 Replies)