But grep -f is pulling the whole file out and writing to output instead of just the matching one's. So I used the xargs. but xargs does not give me any output. Below is the code that I used.
I want to get a list of all the files in the current directory that have two patterns. I can do first grep of one pattern and then with the output do the grep of the second pattern.
if the output of 1st pattern search results in many files, it is very difficult to do a grep of the 2nd pattern for... (1 Reply)
Hi,
Can we grep multiple patterns in UNIX.
for example:
cat /x/y/oratab | grep -i "pattern1|pattern2" .... etc
I require the syntax for multiple patterns. | is not working as I explained in example.
Malay (4 Replies)
Hi All,
I have a file. I need to find multiple patterns in a row and need those rows to divert to new file.
I tried using grep -e / -E / -F options as given in man.
But its not working.
==> cat testgrep.txt
william,fernandes,xxxxx
mark,morsov,yyyy
yy=,xx=
yyyy=,xxxx==
==>... (7 Replies)
I'm trying to parse COBOL code to combine variables into one string. I have two variable names that get literals moved into them and I'd like to use sed, awk, or similar to find these lines and combine the variables into the final component. These variable names are always VAR1 and VAR2. For... (8 Replies)
I have a file with many rows.
I want to grep for multiple patterns from the file.
For eg:
XX=123|YY=222|ZZ=566
AA=123|EE=222|GG=566
FF=123|RR=222|GG=566
DD=123|RR=222|GG=566
I want the lines which has both XX and ZZ.
I know I can get it like this.
grep XX file | grep YY
But... (10 Replies)
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
I am writing it another way to make it clear,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Hi,
I have to write one script that has to search a list of numbers in certain zipped files.
For eg. one file file1.txt contains the numbers. File1.txt contains 5,00,000 numbers and I have to search each number in zipped files(The number of zipped files are around 1000 each file is 5 MB)
I have... (10 Replies)
Hi,
I have a file containing list of strings like
i:
Pink
Yellow
Green
and I have file having list of file names in a directory
j :
a
b
c
d
Where j contains of a ,b,c,d are as follows
a:
Pink (3 Replies)
I am trying to grep a variable with multiple lines with multiple patterns
below is the pattern list in a variable called "grouplst", each pattern is speerated by "|"
grouplst="example1|example2|example3|example4|example5|example6|example7"
I need to use the patterns above to grep a... (2 Replies)
I am able to grep multiple patterns which stored in a files. However, how could we replace the whole line with either the pattern or new string?
For example:
pattern_file: *Info in the () is not part of the pattern file. They are the intended name to replace the whole line after the pattern... (5 Replies)
Discussion started by: wxboo
5 Replies
LEARN ABOUT XFREE86
git-name-rev
GIT-NAME-REV(1) Git Manual GIT-NAME-REV(1)NAME
git-name-rev - Find symbolic names for given revs
SYNOPSIS
git name-rev [--tags] [--refs=<pattern>]
( --all | --stdin | <commit-ish>... )
DESCRIPTION
Finds symbolic names suitable for human digestion for revisions given in any format parsable by git rev-parse.
OPTIONS --tags
Do not use branch names, but only tags to name the commits
--refs=<pattern>
Only use refs whose names match a given shell pattern. The pattern can be one of branch name, tag name or fully qualified ref name. If
given multiple times, use refs whose names match any of the given shell patterns. Use --no-refs to clear any previous ref patterns
given.
--exclude=<pattern>
Do not use any ref whose name matches a given shell pattern. The pattern can be one of branch name, tag name or fully qualified ref
name. If given multiple times, a ref will be excluded when it matches any of the given patterns. When used together with --refs, a ref
will be used as a match only when it matches at least one --refs pattern and does not match any --exclude patterns. Use --no-exclude to
clear the list of exclude patterns.
--all
List all commits reachable from all refs
--stdin
Transform stdin by substituting all the 40-character SHA-1 hexes (say $hex) with "$hex ($rev_name)". When used with --name-only,
substitute with "$rev_name", omitting $hex altogether. Intended for the scripter's use.
--name-only
Instead of printing both the SHA-1 and the name, print only the name. If given with --tags the usual tag prefix of "tags/" is also
omitted from the name, matching the output of git-describe more closely.
--no-undefined
Die with error code != 0 when a reference is undefined, instead of printing undefined.
--always
Show uniquely abbreviated commit object as fallback.
EXAMPLE
Given a commit, find out where it is relative to the local refs. Say somebody wrote you about that fantastic commit
33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the commit, but that only tells you what happened, but not the context.
Enter git name-rev:
% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
Now you are wiser, because you know that it happened 940 revisions before v0.99.
Another nice thing you can do is:
% git log | git name-rev --stdin
GIT
Part of the git(1) suite
Git 2.17.1 10/05/2018 GIT-NAME-REV(1)