Skip to main content

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
2 answers
58 views

command suggestions while typing for beginners

When typing the commands in any shell, can there be any kind of setting that can be enabled for beginners to type just an alphabet and it will suggest multiple commands that the beginner might be ...
Abhishek Dutta's user avatar
0 votes
0 answers
52 views

Vim: using a match (/ regexp) as a boolean to direct program flow

I'm developing a script for Vim to automatically update a "Last modified" timestamp on files. I'm sure this has been done before. I suspect answers will direct me to these existing ...
amphibole's user avatar
0 votes
1 answer
78 views

How to search in a pdf or text file by a regex pattern and output locations of matches?

Is there a pdf viewer that allows me to search its text by a regex expression? In case that I haven't found one, I am thinking about extracting the text and layout from a pdf file by less my.pdf > ...
Tim's user avatar
  • 103k
0 votes
2 answers
82 views

Is there a way to find all PNG files in a folder that have transparent pixels

I have a couple thousand PNGs, all of them probably support the alpha channel but only some of them actually use it (Only some of them actually have transparent pixels). Is there any way at all for me ...
Cestarian's user avatar
  • 2,071
-3 votes
1 answer
77 views

Can I use the DuckDuckGo search engine without Creating a DuckDuckGo Email Protection account? [closed]

Will it be legal if I use the DuckDuckGo search engine without Creating a DuckDuckGo Email Protection account? Or Can I use the DuckDuckGo search engine without Creating a DuckDuckGo Email ...
Md. Sobrul Islam's user avatar
0 votes
0 answers
33 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
42 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,728
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
  • 2,056
1 vote
1 answer
46 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
91 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
  • 621
0 votes
0 answers
65 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
-1 votes
2 answers
167 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
85 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
76 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
78 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
59 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,029
0 votes
4 answers
565 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,304
0 votes
1 answer
113 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
1k 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
823 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,951
0 votes
1 answer
88 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
  • 511
0 votes
1 answer
179 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
  • 511
0 votes
4 answers
137 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
449 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
550 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
676 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
86 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
106 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
97 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
337 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,588
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
37 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
1 vote
3 answers
2k views

Linux search file with given name containing string recursively

From the 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 file name the string name_string and, inside such file(s), ...
Rocco B.'s user avatar
1 vote
2 answers
811 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,951
0 votes
2 answers
671 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,951
-1 votes
2 answers
1k 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,951
-1 votes
2 answers
165 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,951
2 votes
1 answer
124 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
459 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,951
1 vote
1 answer
1k 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
  • 395
1 vote
0 answers
67 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
  • 511
2 votes
2 answers
8k 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
832 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
348 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
898 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
199 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,588
1 vote
2 answers
468 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
978 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

1
2 3 4 5
12