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

Replacing comma if found inside double quotations in a CSV file using sed

I have a CSV file which I need to load to a MySQL table. I rely of identifying the columns end by the , character. That's why it is important that the , does not appear elsewhere other than as a ...
1
vote
0answers
17 views

How to use fzf to search within all lines of files (ignore newlines)?

The fzf examples wiki page describes how fzf can be used to fuzzy search within the content all the files of a directory. But in the examples from the wiki page, e.g. with ag --nobreak --nonumbers --...
-1
votes
1answer
40 views

What is the difference between grep -r and find here?

I'm trying to recursively grep through files in a directory to find a certain string. The solution of my choice is: $ find . -type f -exec grep "string to find" {} \+ ... while using grep ...
0
votes
2answers
35 views

How do I find all sqlite databases inside a bunch of files without file endings?

I have a bunch of files that have just hashes as names and no file endings. (It's an iPhone backup to be precise.) I know there are SQLite databases amongst these files. How do I find them?
2
votes
0answers
29 views

How to search for end-of-line hyphenated words in less(1)

Does less (or any other lightweight pager I could use as $PAGER) has such a feature? For example, if I type man bash and then enter /incorporates it doesn't find the word, despite it being right ...
1
vote
1answer
39 views

How to exclude directory from a command (find command or else)?

How to exclude a folder or path from a command or application in general? I am trying to exclude a path from find command but available possibilities like prune option explained here and here makes ...
1
vote
3answers
39 views

VIM: scripted search and replace?

I am switching to Linux and used to have NoteTab Pro, which allowed me to do scripted search and replaces... as I need multiple replace sequences to achieve a certain outcome. I'd like to put these ...
2
votes
1answer
40 views

Search directories containing numbers larger than a certain threshold in their name

This is the command that I have and would like to modify with an additional condition: find /home/user/backups/ -mindepth 2 -maxdepth 3 -name "*~EEEE000.tif" -print This is the output of ls /home/...
1
vote
1answer
25 views

how to grep color for “0”

Say echo 0 10 20 30 40| grep --color -E '0' I only want the first "0" to be red in color, how do I suppress the zeros from 10, 20, 30... from turning red?
0
votes
1answer
29 views

How to output specific columns separated by a special delimiter using cut

I have a file which contains several columns separated by special delimiter with multiple chracters like this: <xx>. A line will look like this: firststring<xx>11<xx>thirdstring/&...
1
vote
1answer
25 views

Vim search and replace html tags reusing hits

I want to replace html tags in vim but reuse what I found. Namely I want to replace <div class="subSectionTitle"> Title 1 </div> with <h1> Title 1 <h1> I tried to ...
1
vote
1answer
46 views

Rebinding reverse-search-history in bash

reverse-search-history is bound to C-r by default. One can type C-r to start the search, and then type C-r again to jump to an earlier match. I have bound reverse-search-history to \er (Alt-r). This ...
-2
votes
1answer
122 views

Data searching (matching) mechanisms standard in generally all Linux systems [duplicate]

I feel confused about what data searching (data matching) mechanisms are standard in generally all Linux systems, as being utilizable by generally all shell builtins and additional common utilities, ...
0
votes
2answers
41 views

Search Unix file name by positions of the characters in file name

I have 2 files. File 1 = ABC2019120601C File 2 = ABC2019120611C If I type ls -l ABC*C it will output all 2 files. Is there a way to find files by exact position of the character? For example 1st ...
0
votes
0answers
13 views

Debian GNU/Linux 9 (stretch) keyboard inputting characters in the wrong order

I am currently using an HP EliteBook 1040 with Debian 9 installed on it. Recently, I noticed that there is a slight lag when typing at certain points, most noticeably in the search bar, and the ...
0
votes
0answers
47 views

Recursively Find and Copy All PDF files from HDD to a Local Folder

I'm trying to copy all PDF files in an HDD to my computer, without losing any PDF files with different content but the same name, i.e. if I have 3 folders folder1, folder2 and folder3, each with a ...
0
votes
1answer
37 views

how to do string replace (variable value) on one of lines appearing between two patterns and for multiple files

File1.txt ABC123DEF START A B C=?? D END UVZ789XYZ START A B C=?? D END Output expected is ABC123DEF START A B C=123 D END UVZ789XYZ START A B C=789 D END How to do that using ´sed´ / ´awk´ / ´...
0
votes
0answers
42 views

Applying Job Template to subgroups in an inventory on Ansible-AWX

I have installed Ansible-AWX 8.0.0 version by using https://github.com/andyjsharp/ansible-junos-awx. I created an inventory with groups and nested groups. As of now, Job templates are called only on ...
1
vote
2answers
38 views

replace expressions of the form \myExpr{this is a sentence} with “this is a sentence”

I'm sure this has been answered before, but I have a long file with a bunch of expressions of the form \flagThis{Flag this sentence} and I want to replace each of them with Flag this sentence. ...
-1
votes
1answer
21 views

How to find all files that contain the + sign on a directory recursively?

I have tried many suggestions but nothing worked. I have to find all files containing + signs anywhere on the name, like: Hello + World.jpg A + good + file + name + to + find.png Using Ubuntu 16.04 ...
0
votes
1answer
75 views

Regex - Search for valid urls inside archive

I am trying to build a regex so that I look inside a possible URL file in the formats www.url.X http://url.x https://url.x ftp://url I was able to search only with http in a string, does anyone have ...
-4
votes
1answer
38 views

Search for lines that do not have certain characters in a row

I have a news article which I need to edit up a bit. Basically, I need to search for all lines that do not contain characters t and h 2 or more times in a row and replace 4 letter words with character ...
0
votes
0answers
20 views

Search Key Shortcut Mapping in Linux Mint

I am struggling to find an existing key mapping, which prevents me to assign a new one in my IDE. Using Linux Mint I've went through all Keyboard->Shortcuts, yet there is nothing to find, also checked ...
3
votes
1answer
58 views

List of files with a certain suffix in my path and its subdirectories, listed with their last update date

On a Unix server (Sun Solaris), with ls -lrtR I get the list of all the file in my path and its subdirectories with their last update date. With find . -type f -name "*.sas" I find the list of my ....
2
votes
3answers
83 views

How to combine these two grep statements

I need to select the lines that are not empty lines and do not start with //. I can perform two separate grep commands as follows: To extract the lines that are not empty line: grep -v -E '^$' test....
0
votes
3answers
49 views

Find a string in a file and then find the first line above containing another string with bash

How can I find a string in a file, then find the first instance of a line that contains 'srv' that precedes it. I have been looking at Tac and sed, but have been unsuccessful at getting it to work ...
0
votes
1answer
98 views

How to count empty line using grep

I have a text file. Some lines contain text while others do not (just empty line without any spaces or characters: 123 // comment 45 As you can see, there is a line above //comment. If I want to ...
1
vote
2answers
96 views

How to select specific columns from a file with a string separator

I have a file with columns separated by a string. For example: one<xx>two<xx>three<xx>four<xx>five<xx>six one11<xx>two11<xx>three11<xx>four11<xx>...
1
vote
1answer
33 views

Vim - how to replace a space after dot with a newline?

I've pasted some text from the Web into Vim editor and for some reason each paragraph is treated as a single line: PROD $ egrep -i 'system' text Hurricane Dorian is a strong tropical cyclone ...
0
votes
0answers
22 views

How to uninstall HSTR and install reverse-i-search back

I am using Ubuntu 16.04.I installed HSTR and did not like it. I have removed it using apt-get remove hstr and even executed commands from the official uninstall script. I would like get back to ...
4
votes
2answers
136 views

Search For Three Consecutive Words

There are duplicates in my booklist (txt file) like the following - The Ideal Team Player The Ideal Team Player: How to Recognize and Cultivate The Three Essential Virtues Ideal Team Player: ...
0
votes
0answers
19 views

Plotinus - a searchable command palette

I've recently installed plotinus on my system by following the instructions at GitHub. Everythings seems to have gone just fine, and even the installation log is clean as a whistle. However, nothing ...
2
votes
2answers
164 views

Move the cursor directly to `<keyword>` in a long command line

I often find myself in a long command-line, where it can be a pain to navigate to a specific location in the middle by means of Left-Arrow, Right-Arrow, Alt+B, Alt+F etc. I know that using tmux, I ...
3
votes
2answers
143 views

less: search, but ignoring special characters

I'm trying to view large log files. I have a complex shell script that will take a log file and run it through a tangle of text-mangling commands to insert formatting and colouring, and pipe the ...
4
votes
3answers
84 views

How to find character locations of a string in a file?

I need to search for a string (a sequence of characters) in a file with a certain encoding, typically utf8, but return the character offsets (not byte offsets) of the results. So this is a search ...
0
votes
0answers
35 views

Search all disk images for a file name?

When backing up many SD card images onto a large HDD, I am not sure whether one SD card is already included or not. I would like to search all the images for a file name saved on that card, e.g. ...
0
votes
0answers
94 views

Can't Find Installed Software in Ubuntu Search

I have installed some software from downloaded files (not from a repo) but I would like to be able to find them through the Ubuntu search engine in order to have them available in my task bar. For ...
0
votes
2answers
359 views

How can I search date format in vi?

I want to search date format like 2019-07-12 11:22:33. but, in vi mode, :/2019-07-12 11:22:33 is not executed by white space. how can I search 2019-07-12 11:22:33? (other format is not pretty)
0
votes
1answer
422 views

How can I search terminal output?

Say I type git help to learn about the merge command. I don't want to read all the output just the lines that contain merge and their surrounding lines. I thought this would be a common question but ...
0
votes
2answers
81 views

Find searches only for the first matching entry

I have to find all directory paths with specific subfolders. The search pattern is as follows: find /foo/*/searched_folder/bar -maxdepth 0 -type d ̶I̶t̶'̶s̶ ̶w̶o̶r̶k̶i̶n̶g̶ ̶p̶r̶e̶t̶t̶y̶ ̶w̶e̶l̶l̶ ...
0
votes
1answer
201 views

Use reverse i search to cycle through only commands matching pattern

The contents of the command history file using history | less is: 555 ls 556 ls -a 557 echo "hello" 558 echo "hello again" 559 cd 560 pwd 561 echo "hello hello" 562 ls 563 echo "hello hello hello" ...
0
votes
4answers
168 views

Use grep to search for words beginning with non-word characters

The contents of the file testing.txt are: ls -a cmake --verbose verbose I want to use grep to look through this file and find only the word beginning with "--" i.e. the word "--verbose" However ...
1
vote
1answer
62 views

How to express `find`'s -writable and -readable tests, when they are not available?

Sometimes on old Linux systems, I experience that find doesn't support -writable and -readable tests, which test whether the file or directory is writable/readable resp. for the current user. Say, I ...
0
votes
2answers
62 views

Searching whole system for files with specific inode [duplicate]

I technically know how to do all these things, but combining it is problematic. Inode is saved in first line of text file (I can eventually read it directly from file), I need results saved to the ...
0
votes
2answers
1k views

How to find more than one space and replace it with one space?

I want to find repeated spaces (more than one) and replace them with one space. I tried: sed -e 's/ []+/ /g' myfile.txt > myfile2.txt This resulted in an empty file. Why? and how to achieve my ...
0
votes
1answer
38 views

How to express beginning and end of line in sed

I want to use sed to replace every '} that comes at the end of the line to "}. I wrote: sed -i -e "s/'}$/\"}$/g" But this replaces it to: "}$. What is wrong? How can I use regex in my sed to express ...
0
votes
1answer
35 views

How to search for a newline that is not preceeded by } and remove it

I want to use sed to search for line breaks that are not preceded by }. The regex for identifying theses cases is: [^}]$ . What I want to say: If the line ended without } then remove the new line. ...
1
vote
3answers
59 views

How to list all directory paths including a text?

I need to list all directory paths including a text which is part of thier sub-directories. For example, the text is "tpcc" and I have two paths including tpcc as following: /home/arghy/sampledir1/**...
1
vote
0answers
36 views

How do I enable listing of zsh commands as you type

on one of my machines while setting up zsh I seem to have accidentally enabled a pretty useful feature. when I search through command history it actually lists all the matching commands as I type. How ...
0
votes
1answer
130 views

How to capture two regex

In this command, I want to extract strings that are like *.com or *.net, where * is not a dot. I wrote this: grep -P -E '^[^.]+\.com$ |^[^.]+\.net$' example.csv I get this error: grep: conflicting ...

1
2 3 4 5
10