Skip to main content

New answers tagged

0 votes

Command line tool to search phrases in large number of pdf files

Simplest way I found Joining all the above answers, this is the simplest way I found: find . -iname "*.pdf" -exec pdftotext {} - \; | grep -i "what you search" Explanation: ...
Xavi Montero's user avatar
0 votes

How to print only the matched (non‐empty) parts of a matching line, with each such part on a SAME output line?

Another possible solution by using grep and awk: └─$ cat file1 blah foo blah bar blah foo blah bar blah bar bar blah bar foo foo blah bar foo ─$ grep -on foo file | awk -F ":" 's != $1 || ...
sqrt-1's user avatar
  • 137
1 vote
Accepted

How to print only the matched (non‐empty) parts of a matching line, with each such part on a SAME output line?

Here is a way to do the job with a Perl one-liner: ~/dev/perl$ cat file1 blah foo blah bar blah foo blah bar blah bar bar blah bar foo foo blah bar foo ~/dev/perl$ perl -ane '@l=$_=~/(foo)/g;print&...
Toto's user avatar
  • 17.9k

Top 50 recent answers are included