Questions tagged [search]

search is used for questions relating to searching through the contents of files. For searching for filenames using the locate command use the tag locate.

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

Search a binary file for a list of 500 000 binary patterns

I have a list of binary "strings" in a file delimited by newlines. I'd like to use that to search another binary file to check which of these patterns the binary files contains and at which ...
PaperTsar's user avatar
  • 181
0 votes
0 answers
35 views

Recursively find ebooks that match all the search strings

I have few pdf, epub, mobi files. I want to find all files which have the words: all-or-nothing pervasive catastrophizing I mean all words have to be present in the file. They do not need to be in ...
Ahmad Ismail's user avatar
  • 2,648
0 votes
0 answers
32 views

Fuzzy Search for filenames with synonyms and tags (auto generated)

Filesystem: Ext4 I create separate files for each topic. I have thousands of files segregated into 2 or 3 levels of hierarchical broad categories. I would like to search for these files efficiently. ...
Porcupine's user avatar
  • 1,844
1 vote
1 answer
42 views

Search and replace content

PIN A 1 1:3 0:8 0 0:0 PIN B 1 1:0 0 0:0 Z Z:0 PIN C 1 1:3 0:8 0 0:0 Z Z:0 I would like to change the content on PIN A & PIN C only without affecting PIN B to 0 0:3 Z 0:3 Can't seem to find a ...
JSL's user avatar
  • 11
0 votes
0 answers
68 views

Bash reverse search inserting characters into command after hitting tab

SYSTEM: Ubuntu: 20.04 Kernel: 5.4.0-162-generic bash: 5.0.17(1) I found a strange problem that when I use bash's reverse search with CTRL+r, I will find a command I want to run. I select TAB to ...
Dave's user avatar
  • 591
0 votes
0 answers
55 views

How to "fuzzy" match (misspelled) strings in a directory?

I would like to search a directory(tree) with textfiles for strings that are approximately similar to a certain string, similar to this https://en.wikipedia.org/wiki/Approximate_string_matching. I ...
d-b's user avatar
  • 1,891
-1 votes
2 answers
120 views

Search for a string at proximity with another string?

Say I want to search for '123456789' and I want it to be near 'firstname'. Is there a way to do it? I've 0 logic to do this. Maybe piping greps could work? What kind of algorithm is best suited for ...
achhainsan's user avatar
1 vote
1 answer
70 views

Just as there is "locate" to "find". Is there a database for a faster "grep"?

locate (or rather, updatedb) is somewhat simple: it takes the output of find for the required paths (usually '/'), sorts it, and then compresses it with a front-compression tool (frcode), in which the ...
Sebastian Carlos's user avatar
0 votes
1 answer
66 views

How to do a random search in vi editor?

By random, I mean neither from top, nor from middle, nor from bootom. The search should return randomly ordered results. eg: I am searching for "failed" in vi editor. I want randomly ordered ...
achhainsan's user avatar
0 votes
1 answer
62 views

find content of files with other text and combination of xml tags, grep in grep?

I have a lot of files that match a grep 'xmltag' and 'subtag'. random xml needed_text random xml <xmltag> <subtag>content</subtag> </xmltag> I want to search for files that ...
Jvo's user avatar
  • 3
1 vote
1 answer
55 views

How to search for strings in the output of previously run commands

Say, for example that after running a number of commands: $ cd /opt/something $ find . -name *aa | grep 11 $ clear $ <more commands go here> there was a part of the output that was needed ...
Sebi's user avatar
  • 1,009
0 votes
4 answers
185 views

Grep, but for binaries

I've got a fragment of an image file produced by data-recovery software. I suspect the complete original is somewhere on my home fileserver. If this were a fragment of a text file, I could just grab ...
Mark's user avatar
  • 4,204
0 votes
1 answer
111 views

How do I find and replace something AFTER a specific term in a terminal output

I need to run blkid and copy a specific UUID after a specific known partition name. Then, I need to paste this into an exists config file, replacing a UUID that it's already there (parent_device_uuid)....
Capybara_Overdose's user avatar
-3 votes
1 answer
853 views

How to set up local Windows directory in WSL correctly?

I ran this script in Windows Subsystem for Linux at the command line. I wanted to search for the latest files but I got the error message "no such file or directory", and so I wonder how do ...
Anna Nguyen's user avatar
0 votes
1 answer
721 views

ansible lineinfile module to match variable_value

how can one possibly match value of a variable through regex parameter in lineinfile module? - name: emptyline before search lineinfile: dest: ~/file insertbefore: '^{{ search_text }}$' ...
Sollosa's user avatar
  • 1,919
0 votes
1 answer
78 views

uncomment the line upon search string while ignoring case in a file

Below is my cron file entries: #Ansible: test2 */15 * * * * ansible-playbook /web/playbooks/automation/detect401MORTEN/va_action.yml | tee -a /web/playbooks/automation/detect401MORTEN/cron.out # #...
Ashar's user avatar
  • 491
0 votes
1 answer
165 views

How to get one line above the enabled crontab entry

I have the below crontab entries $ crontab -l #Cron to auto restart app1 #Ansible: test1 #*/15 * * * * ansible-playbook /web/playbooks/automation/va_action.yml #Cron to auto restart app7 #Ansible: ...
Ashar's user avatar
  • 491
0 votes
4 answers
135 views

Given a filepath, how do I find every copy of that file?

I know of programs such as rdfind or fdupes. They solve a similar but more complicated problem. Given a file path and a directory, I want to search that directory recursively for every copy of that ...
con-f-use's user avatar
  • 423
0 votes
2 answers
408 views

search of .xml files without certain tag through mac os terminal

I would appreciate having your advice on the below. Having a folder name "ABC" with thousands of .xml files inside. The core structure of XMLs is the same: <product abcd…> <...
Aleks Under's user avatar
1 vote
1 answer
518 views

Search Hexadecimal Sequence from start position until some defined number of bytes of huge Binary File (grep, sed)

In my Mac, I have this binary 'file' /dev/disk0s1 with 512GB (Really is a drive or volume according to AFPS of macOS) and I need to find this Hexadecimal Sequence 0x41, 0x50, 0x53, 0x42 for APSB (in ...
joseluisbz's user avatar
3 votes
1 answer
548 views

used awk to search by unicode in txt file

How i can used awk to search in txt file by unicode like : u+064C u+064D and please how i count results and print the number in first line.
alomndo's user avatar
  • 33
2 votes
2 answers
78 views

search in txt file and every result in new file

For context, this is a follow-up on search in txt file then print in new txt file with a few extra complications. I have 2 txt files the first one is data.txt file which contains over 2000 lines, the ...
hafmoon's user avatar
  • 23
0 votes
2 answers
102 views

search in txt file then print in new txt file

i have txt file which containt over 1000 line, the data in it like: alpha hmld ahge 573 otndgd fhj 29 fidnt ank 1962 beta jdkrs 2 adny 14 urmekhjf 6893 ... how i can search and print (in new txt ...
hafmoon's user avatar
  • 23
0 votes
2 answers
89 views

script to print word at specific location at specific line into a new file

below is the file from which the data should be copied from a specific line and specific location CP I ({010010010010010010010010010010}000 000) 234764-CTS_fsdfs_a_inv_33ghf/ZN --- I ...
vikas's user avatar
  • 1
0 votes
1 answer
297 views

How to find a property file matching a pattern in a group of JAR files?

I'm using bash shell. I have a group of JAR files in directories at different levels > find . -name "*.jar" /tmp/jars/META-INF/lib/jackson-datatype-jdk8.jar /tmp/jars/lib/my-custom.jar .....
Dave's user avatar
  • 2,498
1 vote
2 answers
2k views

How can I search only git tracked files with a specific file extension?

I'd like to search all git tracked files that 1. has an .hs file extension and 2. contain the word import in any lines. I've tried to use git ls-files -z | xargs -0 rg -g '*.hs' "import" ...
Chris Stryczynski's user avatar
0 votes
0 answers
33 views

Get a list of the last opened text and odt files

can I retrieve a list of the last opened textfiles (well, I have some textfiles without ending .txt which is probably not possible to retrieve. Some do have a .txt ending though) Also I need the last ...
von spotz's user avatar
  • 435
0 votes
2 answers
1k views

Linux search file with given name containing string recursively

From Linux shell, Let's say I'm in directory /dir and I want to find, recursively in all subfolders, all the files which contain in the name the string name_string and, inside, the string ...
Rocco B.'s user avatar
1 vote
2 answers
704 views

awk get column value from file 2 for file 1 if value matches in 2 columns [duplicate]

I have 2 files, trying to set column value that is taken from file2 into file1 when their columns match file1: signup||20200620|A3332|en|LA||ACTIVE signup||20200620|B4443|en|CA|66001|ACTIVE signup||...
Sollosa's user avatar
  • 1,919
0 votes
2 answers
599 views

replace text in specific field with variables from loop

I have a huge file to parse & need to search and replace text but in specific fields, sharing a small sample for reference named dest. first row is header for reference. cat dest ID|NAME|COMPANY|...
Sollosa's user avatar
  • 1,919
-1 votes
2 answers
933 views

awk no print if value from file1 not match value in file2

file1: G A 4 H B 3 I C 2 J D 1 file2: M H 6 N H 5 O K 4 P J 3 Q I 2 R I 1 S G 0 T L 1 Desired: M H 6 N H 5 P J 3 Q I 2 R I 1 S G 0 print only rows where $2 from file2 matches $1 from file1 I'm ...
Sollosa's user avatar
  • 1,919
-1 votes
2 answers
152 views

awk bring same field value from file1 and set in file2 [closed]

File1 (parent) 2210 1110 Earth 2211 1111 Marse 2212 1112 Saturn 2213 1113 Pluto File2 (child) 3310 2210 Earth 3311 2210 Space 3312 2211 Mars 3313 2211 Space 3314 2212 Saturn 3315 2212 Space 3316 ...
Sollosa's user avatar
  • 1,919
2 votes
1 answer
120 views

Global search + replace, but only in cases where a test passes

I want to do a global search and replace on a directory of files. There are various ways to do this (many editors, sed+find), but I have an extra requirement. I want, for each possible replacement to ...
Chris Jefferson's user avatar
-1 votes
3 answers
434 views

awk print only modified lines

I have file like this d1000 1000 d1001 100 d1002 10 d1003 1 I want to modify second column where length is not equal 4. But I want to print only lines that are modified, so original text in column 2 ...
Sollosa's user avatar
  • 1,919
0 votes
1 answer
993 views

Where does "apt list" search?

apt list can list all packages available, does apt search in some database or file in some directory? apt list --installed can list all installed packages, where does apt search then?
showkey's user avatar
  • 285
1 vote
0 answers
65 views

How to find the PHP file which prints an HTML element with a certain selector?

I store my MediaWiki 1.36.1 website with Skin:Timeless on NameCheap with a shared hosting environment with Cpanel file manager and SSH shell access. In my website, there is a certain footer element ...
searcher's user avatar
-1 votes
1 answer
52 views

Search & replace for a string separated by whitespace upon substring match found

Below is a sample file content: cat sample.txt -server -XX:+UseParallelGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+AggressiveHeap -XX:+PrintHeapAtGC -Djava.util.logging.FileHandler....
Ashar's user avatar
  • 491
1 vote
2 answers
6k views

How can I see the line number of a searched text?

Suppose, I have a text file named output.txt which contains 1.46 million rows of data. I want to search a text 27QL in the file. If the text exists, Linux should return the line number. How can I do ...
user366312's user avatar
0 votes
0 answers
724 views

Searching strings in raw disk image

I am currently writing a tool that should scan a readonly raw disk image for a a given pattern. The task is to get the byte offset of the match. I am able to find simple text documents with grep -a -o ...
unrealwombat's user avatar
0 votes
4 answers
299 views

Search and Remove Lines of Code from all files

I need help and need to search for and remove a 3 line bit of code from all files in a directory. Code is: if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) )...
Adam Giddens's user avatar
0 votes
1 answer
801 views

Why is this mv command trying to write to a directory?

I'm using this search and replace string; find . -name 'xna*jpg' -exec bash -c ' mv $0 ${0/\ (2018_05_28 14_04_27 UTC)/}' {} \; So that it will replace "xna (2018_05_28 14_04_27 UTC).jpg" ...
Harry McGovern's user avatar
2 votes
3 answers
1k views

Replace dynamic word using sed command

I have a requirement where we need to replace a word in a file which can be different everytime I execute the script, the content of the file is class DynamicContentToReplace > Something Here I ...
curious_dev's user avatar
1 vote
1 answer
172 views

How do I configure ag so that it will also search for files beginning with a "."?

I'm using ag v 2.2. How do I configure ag so that it will search for files beginning with a "." in addition to all other files? I'm noticing I have a file like so $ cat client/.env....
Dave's user avatar
  • 2,498
1 vote
2 answers
407 views

How to have "apt search" give one-line summaries?

apt-cache gives one line summaries: $ apt-cache search conway golly - Game of Life simulator using hashlife algorithm libclass-delegator-perl - Perl module for a simple and fast object-oriented ...
Ana's user avatar
  • 21
4 votes
2 answers
944 views

Search PDF files with more than 100 pages and moving them into directory in UNIX/LINUX terminal

I'm trying to search for PDF files that have more than 100 pages and then moving them into a specific directory in the UNIX/LINUX terminal. Something a bit like this: find . -name '*.pdf' -pagenumber&...
AlexLee's user avatar
  • 143
5 votes
1 answer
737 views

Using anchor ^ pattern when using less / search command

When navigating through Linux man pages, sometimes you need to query the meaning of flags like -p or -al in the man pages. The default text reader for man pages is less and I'm trying to use the / ...
Silver137's user avatar
  • 329
0 votes
1 answer
526 views

How can I make pacman search look better?

Currently I am using Arch. Pacman is a great package manager but can I make pacman search look better (pacman -Ss). For example if I search for a package it gives me result lik this: extra/foomatic-db-...
Anuj Tambe's user avatar
0 votes
1 answer
1k views

Is there a way to search in only properties file when using grep?

I am normally searching like this grep -rnws '/path/to/directory/' -e 'JMSAppender' However this does display all jar files and class files where it might be used. I need to check only inside log4j ...
minusSeven's user avatar
0 votes
1 answer
107 views

Search for all videos created on a Saturday

I am using Linux Mint. There are several years worth of files and folders scattered everywhere. My goal is to find a way to search my entire hard drive for any video files that were created on a ...
securityauditor's user avatar
0 votes
1 answer
155 views

Is it possible to integrate pdfgrep into nemo search?

I often find myself looking for PDF documents. Luckily, I found pdfgrep that really does a great job at finding PDF documents by content. Following command lets me search for documents that have my ...
Charles David Mupende's user avatar

1
2 3 4 5
12