However, I wanted to fetch the first line after the 'STARTREGEX' as well, as each pattern block name(1st line after the pattern) containing the matched string is also required.
I missed to mention the above prior !
E.g.:
So, here I wanted the output like:
Awaiting your suggestions..!
Moderator's Comments:
Please use CODE tags (as required by forum rules) when displaying sample input, sample output, and code segments.
Last edited by Don Cragun; 04-24-2017 at 03:30 AM..
Reason: Add CODE tags.
Hello,
I barely know the basics, but I am very determined to learn. I want to parse a few characters from each row, use that string to search another file and display the line number where I found the value in the file. I don't know if this can all be done on the command line, so I am creating a... (2 Replies)
Hi,
I need to search for a multiple string pattern(5 key words) in a file(similar to a flat file) ,and i need to store the output in a another file .
In that file we may have mutiple occurrences of the key words.and i need only the unique.
kindly help out.
Thanks,
Mohana Krishnan (2 Replies)
Hi,
I want to grep the line which has 'data11'.then from that line, i need to trace back and find out the immediate line which has the same timestamp of that grepped line.
for eg:
log file:
-----------
Process - data
Process - datavalue - 2345
Process - data
Process - data
Process... (9 Replies)
I've got a semicolon delimited file. I would like to search for fields that match a pattern, and not hardcoded eg "mth".
*th=something
If the delimited field fulfills this condition, eg. mth=value
I would like to print out both key and value for some number comparison.
eg. if value > "12"... (5 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-00001=5
....
ERR-01010=10
.....
ERR-99999=10 (4 Replies)
Hi ,
I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code.
my $current_value=12345;
my @users=("bob","ben","tom","harry");
open DBLIST,"<","/var/tmp/DBinfo";
my @input = <DBLIST>;
foreach (@users)
{
my... (11 Replies)
Hi,
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)
Hello,
I have a file which has the below contents :
VG_name LV_name LV_size in MB LV_option LV_mountpoint owner group y
testdg rahul2lv 10 "-A y -L" /home/abc2 ... (6 Replies)
Hi,
How can I use find command to search string/pattern in a file recursively?
What I tried:
find . -type f -exec cat {} | grep "make" \;
Output:
grep: find: ;: No such file or directory
missing argument to `-exec'
And this:
find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies
LEARN ABOUT HPUX
fnmatch
fnmatch(3C)fnmatch(3C)NAME
fnmatch() - match filename patterns
SYNOPSIS DESCRIPTION
performs pattern matching as described in regexp(5) under By default, the rule qualifications for filename expansion do not apply; i.e.,
periods (dots) and slashes are matched as ordinary characters. This default behavior can be modified by using the flags described below.
The flag argument modifies the interpretation of pattern and string. If which is defined in is set in flag, a slash character in string
must be explicitly matched by a slash in pattern; it cannot be matched by either the asterisk or question mark special characters or by a
bracket expression.
If is set in flag, a leading period must be explicitly matched. It will not be matched by a bracket expression, question mark or asterisk.
By default, a period is leading if it is the first character in string. If is set in flag, a period is leading if it is the first charac-
ter in string or immediately follows a slash.
If is not set in flag, a backslash character in pattern followed by any other character matches that second character in string. In par-
ticular, matches a backslash in string. If is set, a backslash character is treated as an ordinary character.
If flag is zero, the slash character and the period are treated as regular characters. If flag has any other value, the result is unde-
fined.
RETURN VALUE
If string matches the pattern specified by pattern, returns zero. Otherwise, returns non-zero.
EXAMPLE
The following excerpt uses to check each file in a directory against the pattern
pattern = "*.c";
while(dp = readdir(dirp)){
if((fnmatch(pattern, dp->d_name,0)) == 0){
/* do processing for match */
...
}
}
AUTHOR
was developed by OSF and HP.
SEE ALSO sh(1), glob(3C), thread_safety(5).
STANDARDS CONFORMANCE fnmatch(3C)