Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 264385

grep is a command-line tool for searching text patterns in files

1
vote
1answer
So the following grep matches 2 lines. grep -w 1.2.3.4 testfile.csv 1.2.3.4,Jim,Jonson,000000 1.2.3.4.5,George,Doe,FFFFF How can I make it match exactly and only the specific word? In this … example only 1.2.3.4. Let's assume that whitespace in the beginning or next to the comma separator may appear and I would like this to be if possible cross platform grep. …
asked Mar 27 '18 by Jim
1
vote
1answer
files| grep "^\+" | grep "$PATTERN" | for loop grep -n.. do git blame -L done This works but I was wondering if I am re-inventing/going a roundabout for something that is readily supported in git. Is there a better way? …
asked Jun 7 '18 by Jim
7
votes
4answers
Is there a way to avoid doing grep two times in the file and just populate the variables in one pass? The file is small so it is not that a big deal I was just wondering if I could do it in one pass … FIRST_NAME=$(grep "$customer_id" customer-info|cut -f5 -d,) LAST_NAME=$(grep "$customer_id" customer-info|cut -f6 -d,) …
asked Mar 27 '18 by Jim
-1
votes
1answer
I have a file test.xml (shown below).  This grep works: grep '<appointment-id internal:ref=1.2.3/>' test.xml Output is: <appointment-id internal:ref=1.2.3/> But this fails: grep "$(grep … '<appointment-id internal:ref=1.2.3/>' test.xml)" test.xml Output is: grep: invalid character range Contents of test.xml: <note> <to>Jim</to> <from>John</from> <heading>Reminder …
asked Jun 7 '18 by Jim