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
1answer
275 views

vim search and replace command to replace `(*,*)` with nothing

I'm reworking some Fortran code. I need to remove the pattern (*,*) using vim's search and replace function. The following does not work %s/\<(*,*)\>//gc %s/\<(*\,*)\>//gc %s/(*,*)//gc ...
4
votes
2answers
102 views

Extract Sub-Directory Path from Partially Known Directory

Lets say I've got the following directory structure: base/ | +-- app | | | +-- main | | | +-- sub | | | +-- first | | | | | +-- tib1.ear | ...
2
votes
1answer
3k views

Find hex value in files/folder

Is there a way to search for a hex value in files / folders? I've tried the following: grep -P "[\x01\x02\x03]" but that doesn't work (there is no error, but it doesn't search for these hex values).
0
votes
1answer
42 views

How do I extract a portion of an SQL statement for the purposes of searching and replacing?

I'm using bash shell attempting to do a search and replace. I have a file of lines that look like ... INSERT INTO currency (name, code, symbol) VALUES ('Baht', 'THB', '฿'); ... and I want to ...
2
votes
2answers
2k views

How to tag everything stored in a Linux filesystem?

How would I accomplish the following in Linux using the BTRFS filesystem? In Mac OS X El Capitan you can use tags to organize files. You can tag files and folders to make them easier to find. Tags ...
-3
votes
3answers
63 views

how to find a text and copy the text after?

I have a script that create a txt file with a lot of information. I want to check if there is a specific text in it, and copy what come after. for example, this is the txt file: blablablaWANTEDTEXT[...
3
votes
4answers
370 views

grep: Which *patterns* are matched, not which text?

In maintaining our local logcheck rules, it'd be nice to know which ones are no longer being used. I'm trying to find a reasonably efficient way of doing that. In other words, given a fairly large ...
1
vote
2answers
6k views

search domain in resolv.conf is not appending to hosts when doing ping or other network communciation

I am trying to find out why multiple search domains do not work with Debian 8.8.0. If you add the search domains in /etc/resolv.conf it will only work with one of them & in this case domain1.local ...
1
vote
3answers
923 views

grep command to display same word with different spellings

I created one table of employees. 1 Andy Account 2 Grecie HR 3 Jyorge Marketing 4 Seeya HR 5 Princy Account 6 Siya Production Here the names of 4th employee and 6th employee ...
0
votes
3answers
161 views

Explode Depth Search in UNIX

I've a following data in file which has user and supervisor relationship. user |supervisor |id -----|-----------|---- a | b | 1 b | c | 2 c | d | 3 e | b | ...
0
votes
1answer
4k views

Replacing a Part of URL String in a Linux File With Another String

I have an HTML file on a Linux server that contains a long list of links. I am trying to edit this file as follows. Find original occurrences of this type: http://www.test.org/name Replace them with: ...
2
votes
1answer
695 views

How to add repository and install TMSU in Debian 9?

The package TMSU (preview here) information is done for Ubuntu here but trying to apply for Debian 9. I do the following but get the following masi@masi:~$ sudo add-apt-repository ppa:tmsu/daily [...
2
votes
4answers
8k views

How to pass POST parameters to open a webpage in browser?

We can open a website with GET parameters in the browser as follows #!/bin/bash echo 'enter username' read username firefox "https://github.com/${username}" This comes in handy because I can now ...
1
vote
0answers
54 views

Is there a content search program/port (*not* index based) that's efficient for files needing text extraction filters

If using FreeBSD as a file server for windows clients, it's useful to be able to run file searches server-side rather than client-side. A typical example might be: find all files meeting some ...
1
vote
1answer
800 views

How to search “info” page for keyword

I'm currently looking through the "info" page for "ls" command and I want to find all relevant sections that contain the keyword "-l". But I'm not sure how to search for keywords and how to move ...
1
vote
1answer
1k views

How to use non greedy regex in grep?

This page says that any multiplier in a regex can be suffixed with '?' to do a non greedy search. However, I can't figure out how to make it work in grep. grep -E '^.*?$' file prints the whole text. ...
2
votes
4answers
169 views

Find all lines that follow a pattern and begin with a character

So I have many Jekyll posts in _posts with metadata YAML in the header, including categories, like this: --- excerpt: "I am an excerpt" categories: - tips - programming - howto - another-tag layout: ...
2
votes
1answer
27 views

How to give a program an additional name/label for search?

I am starting a lot of programs via the synapse launcher. For convenience, I'd like to give a program an additional name/label/tag/whatever, such as "XXYYZZ". Is this possible (on XFCE)?
3
votes
2answers
602 views

Why is it not possible to search through text file contents encoded in UTF-16?

I understand that e.g. catfish and gnome-search-utils both can search inside file contents that are UTF-8 encoded. To be able to search for words or numbers within text files one would have to convert ...
0
votes
1answer
289 views

Searching a text with grep in Vim

i am doing some exercies in vim and i have a problem. I need to find a piece of text in another file in the same directory with my vim file. I used grep to find it but i had an error."bad situation" ...
2
votes
1answer
1k views

Filtered List of Files Containing String

I'm looking for files that contain a string. My command: grep -rwl '/path/' -e "string" I want to limit the result to paths that contain a different string. I can do it like this: grep -rwl '/path/'...
1
vote
2answers
207 views

Search and replace is not respecting my “$1” token

Using bash shell on Ubuntu 14.04. Trying to do a simple search and replace on every line of a file. I have tried perl -pi -e "s/.*/DELETE FROM my_object_times where ID = '$1';/g" ids.csv but this ...
1
vote
1answer
96 views

Searching question marks in man

I did man maldet trying to get information about (what I can call) maldet wildcards which are represented by question marks. I clicked / and searched \? and also for "\?", but nothing was found even ...
14
votes
1answer
5k views

Use case sensitive search for lower-case string using smartcase

I normally enable smartcase in my .vimrc. Without smartcase: If I want case-insensitive search, I write in upper-case or lower-case (doesn't matter) and append a \c at the end of the query. Case-...
2
votes
2answers
433 views

Using sed (or anything useful) to replace strings with relative content

Usually to replace strings across multiple files, one simply needs to use sed -i 's/string1/string2/g' * However, how could I use the sed command (or anything that works, really) to replace things ...
3
votes
2answers
83 views

Add extension to all files within a directory that contain exact string

I have a large directory with multiple levels and tons of files. A majority (but not all) of these files are HTML files, but do not have the .html extension (a problem when copying over to Windows). ...
3
votes
3answers
762 views

Print out list of files less than specified file size

I'm trying to create a script that can be executed to search a list of files, compare the file size field to the specified file size, and then display the files that are less than the specified file ...
2
votes
1answer
122 views

Can I search a file according to specific character types?

Im looking to search through a file containing a list of license plates. If the license plates are formatted as ABAA BAB, where A is a number and B is the letter of an alphabet, is it possible to ...
3
votes
2answers
107 views

How can I find which csv files are related (i.e., have foreign key references) to others?

An external vendor has provided me a data dump of 20+ tables as *.csv files. Their documentation is lacking so I'm having to manually go through the files to find out which files are 'related' in an ...
1
vote
1answer
30 views

URL keyword searches in GNOME 3

I'm trying to find something in GNOME 3 to support keyword based searches. For example, I want to enter "yt car boys" in the system search dialog, and have it bring up https://www.youtube.com/results?...
2
votes
1answer
307 views

Linux Document Management

I'm looking for a Linux (Freeware preferred) replacement for the Paperport Document Management Software by Nuance. Wants: Scan to PDF. OCR. Simple Indexing and Searching. Data stored locally. ...
18
votes
1answer
7k views

How do I use ag to look for text in files with certain extensions?

I'm using ag (The Silver Searcher) version 0.31.0. I can easily look for a string in a bunch of files using: localhost:workspace davea$ ag 'ftp' . But what if I only want to scan files with certain ...
0
votes
0answers
67 views

A letter is missed in Russian words to be searched in VIM

When I run: $ vim -s <(printf '/конфедерация') VIM opens and shows '/конфедерция' in the left bottom corner without 'а'. Why? There is no problem with '/стол' for example. But if the word is a ...
2
votes
1answer
525 views

How do I replace tokens from one file with data from another?

I'm using Amazon Linux with bash shell. I have a file with comma delimited data, where each row looks like this 2049,576804C7DF554416A9EA25B2A5A81514,X, Then I have a second file, with comma ...
0
votes
0answers
73 views

Script to search lines from a .csv or .pdf on Google [closed]

I have a file with a long list of names, but without their e-mail addresses. Because the list is very long, I would like to build a script that takes each line from the file (it can be PDF or CSV) and ...
3
votes
3answers
82 views

How to use an input file of non-exact filenames for an operation?

I have a file of filenames for files in a certain directory. However, some of the file names may: Have spaces in the original filename replaced with underscores (so directory/file with spaces ...
0
votes
3answers
2k views

How to use grep for finding file location in linux machines? [duplicate]

How can search for a file in ubuntu os with grep command ? Let's say, I want to find CMakeList.txt, how to write grep command to find the existence of this file ?
2
votes
1answer
114 views

Extract a single file from a list of directories in Linux

I have a folder that contains 1208 folder. In each of these folders, I have 6 different files which follows a special naming criteria. What I need to do is to get only one of these files from all the ...
-1
votes
1answer
326 views

Search file for string with variable content

Searching a file for a string is fairly straight forward, usually involving the cat *** | grep *** command. Whilst this is appropriate in most instances, I am trying to search a file for a string for ...
-1
votes
1answer
183 views

How to search and replace in the entire system? [duplicate]

Say I have an IP address + domain (1.1.1.1/example.com) appearing in many different files which are prevalent inside different files throughout the system and I want to change it's IP to something ...
1
vote
1answer
242 views

How to remove/alter search results from Linux Mint start menu?

Linux Mint 18.0 Cinnamon Edition has a start menu, which can quickly be launched with the windows key. Typing thereafter brings up search results, which have a functional or descriptive relation to ...
4
votes
3answers
2k views

sed string replacement for exact match containing /

I am trying to use sed to search for the occurrence of an exact string that contains / in it. Below is the approach I am trying, but without luck. input_string="/path /path1 /path2" search_string="/...
1
vote
3answers
233 views

Grep something specific of the results of last execution?

I've installed some utilities from the CLI and got quite a long verbose output describe what was installed directly, what needed some dependencies, what is no longer needed to be installed, etc. Is ...
1
vote
1answer
27 views

Is there a way to find patches which need testing from packages you have?

$ dpkg -l Gives you a list of all packages installed on your system. Now some bugs on the Debian BTS are tagged patch . Now is there a way to list all packages which are installed on your system for ...
-1
votes
2answers
96 views

Multiple years grep [closed]

How can I grep exact years in my file which contains world champions from years 1950-2000 but I want only years 1950/60/70/80/90/00? Thank you so much
0
votes
3answers
1k views

Search multiple directories and output file names

I have a list of 7 directories. Every day they get a file. I would run one command that would check all the directories at once which provides the output of the file names. Normally I run ls /...
4
votes
3answers
4k views

List files in all subdirectories by creation date

I have forgotten the name of a file which is in a directory or one of its subdirectories. I remember the file's extension (.nb) and know approximately when it was created. How can I list all file with ...
1
vote
1answer
743 views

Finding a missing sequential number in a data file

How can I search a large file with 'sequential numbers' (that reset after 16) in a particular column to find a missing line? I have a data file: col1 col2 col3 col4 col5 1 col1 col2 col3 col4 col5 2 ...
-1
votes
1answer
80 views

finding specific directories

I need to find all directories that begin with dirD in the directory /dirA/dirB/dirC. Basically, dirD*. So far I tried: find . -type d -name "dirD*" and ls -lrt | grep "^d" | grep "dirD*" Now I'm ...
9
votes
4answers
2k views

How to find files that don't have empty line at the end?

I have files in subdirectories of the current directory that may or may not have new lines at the end; how can I find files that don't have a newline at the end? I've tried this: find . -name '*....