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.

learn more… | top users | synonyms

1
vote
1answer
28 views

Modify Gnome 3 search bar results

Is it possible somehow modify results of default search bar in Gnome 3? I'm currently having a little problem with launching calculator app. I always pressed Super and typed "calc" and enter. But ...
0
votes
6answers
46 views

How can I use grep to search only on the first line of files for a specific string?

How can I use grep to find a string in files, but only search in the first line of these files?
0
votes
2answers
51 views

Search a line and replace line

false###File.txt many rows ###online = false --> ONE SHOT import (delete all table contents before importing) ###online = true --> DIFFERENTIAL import (import without clean the table contents) ...
3
votes
2answers
43 views

less: /pattern search starts at first line

Consider the following file: $ LESS= \less test abc def abc By default, searching /abc in less will jump to line 3 since /pattern search starts at second line according to man 1 less: /pattern ...
4
votes
6answers
371 views

How do I grep recursively through .gz files?

I am using a script to regularly download my gmail messages that compresses the raw .eml into .gz files. The script creates a folder for each day, and then compresses every message into its own file. ...
0
votes
1answer
60 views

Space removal after a pattern in SED

I have a file instrument.xml bash-4.1$ more instrument.xml <instr instr_id="CPT-2380950-011-001-826" valor_ch="" instr_type="CurrentAccount" instr_name="CPT-2380950-011-001-826" qn_type="1" ...
3
votes
2answers
94 views

Select added lines from file

I have two versions of a file where the newer one has some lines added. The files are sorted (think of wordlists) and I want to print out the newly added lines (given file1 and file2). I know how to ...
2
votes
1answer
35 views

Is it possible to make VIM emphasize found text?

As vim wiki's stated we can look up strings by using *. But by default, looked up string is not being emphasized. Is it possible to configure vim that the strings will be emphasized when looked up ...
2
votes
2answers
51 views

How to search many files with regular expression and output matches to lines in a new file?

I have 1000's of source files and I would like to find all text that matches a regular expression and then output each match on its own line in a resulting text file. For instance; // a.cs string ...
-1
votes
1answer
48 views

How can I recursively grep through several directories at once?

I use grep -r all the time to find occurrences of a string within files in a given directory: $ grep -r "string" app/assets/javascripts > app/assets/javascripts/my_file.js: this line contains my ...
1
vote
2answers
25 views

Where is pithos installed?

I'm trying to find the installation directory in Pithos so I can hack it, and am really bad a unix commands and am embarrassed to ask this. If I do: `which pithos` This returns a link to the ...
1
vote
1answer
109 views

Searching file based on data range

I previously posted requesting help with counting occurrences of a string. I'm now hoping to search for the occurrence of a string within a range of values and print out a similarly formatted file ...
2
votes
2answers
72 views

Search and Replace question

I need to find all occurrences of AAsomeArbitraryStringBB and replace it with CCsomeArbitraryStringDD. So AAHelloBB Text AAByeByeBB becomes CCHelloDD Text CCByeByeDD. It's important to note ...
0
votes
1answer
32 views

For value falls within a range get corresponding value

I am thinking to use awk to search a value from input file in a reference file and get a corresponding value from reference file. Both reference and input files can be sorted based on $3 and $2 ...
1
vote
1answer
20 views

How to disable mail search in tracker-needle?

I wish to search only my local folders. Everything was ok, until I installed thunderbird and downloaded mail. Now searches take too much time, because tracker searches the mail to. Where in the ...
1
vote
2answers
62 views

How do you search and replace multiple lines in KDE Kate?

how do you replace multiple lines of code in Kate? The following is the original text: <div id="image"> <br style="clear: left"/> <br style="clear: left"/> <br style="clear: ...
5
votes
3answers
187 views

grep for multiple regexes, and count the number of occurences

Say, I have a file, and multiple regexes have to be searched in it and the number of matches for each regex has to be counted. Thus, I cannot combine the patterns: grep -Po ...
0
votes
1answer
52 views

how to find file defining an alias

I am having a problem I'm not sure how to get around. Somehwhere on my system, I have an alias defined as such: alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\' I ...
4
votes
2answers
114 views

Error getting the string between two patterns

I want to get a string between two patterns. The pattern is the first environment <p> </p> in an html file. <p>Sorcery, R (1) </p> <p ...
5
votes
3answers
89 views

Find latest copy of same file in folder structure

I need to get the path of foo.txt in a folder structure. There are multiple foo.txt files in this structure but I need an automated to find the latest. Suggestions?
1
vote
2answers
42 views

How to limit the number of search results per directory

How to limit the number of search results per folder, for example: With this command: grep --include=*.php -Ril '<?' '/var/www/' I get the following: /var/www/test.php /var/www/test1.php ...
1
vote
0answers
32 views

Review GREP and FIND results in Xemacs

I spend a lot of time searching code. I really like grep and find, because of all the options available. But it takes way too long to navigate the results. I use xemacs and it takes 3 more commands ...
1
vote
2answers
214 views

find field pattern in a csv file then count unique field values

I am using Cygwin (bash) to create a script to find, group and count fields in multiple CSV files. Each row will have comma-separated fields with each field following a similar convention. There is a ...
2
votes
1answer
162 views

Highlight the current search match in man pages

When I open a man page, for example man chmod and I hit / for searching a string in the page I can see all the matching strings highlighted. Pressing n or N will focus on the next/previous matching ...
4
votes
2answers
800 views

Limit grep context to N characters on line

I have to grep through some JSON files in which the line lengths exceed a few thousand characters. How can I limit grep to display context up to N characters to the left and right of the match? Any ...
1
vote
2answers
65 views

extract certain string, search and replace or keep a longer string contain the extracted value

The input file that needs to be edited is as below (can have more rows): bundle_id target_id length eff_length tot_counts uniq_counts est_counts eff_counts ambig_distr_alpha ...
1
vote
2answers
67 views

Strings not outputting text found using grep

I am looking for certain strings in (Windows) executable files. First I started with grep -a string file as that treats binary files like text files. The problem there is there is no neat output, ...
6
votes
1answer
112 views

Linux: Locating text file from a string input

I have started to use Linux and I'm practicing using/making codes to locate and do things. I need help with code that locates any file from a string of input. I don't know where to start?
2
votes
2answers
75 views

Livesearch with first 10 matches as preview for zsh-history?

I have seen a history-livesearch with a preview, that shows the 10 first matches in the history in a list below the BUFFER-line, which is updated on every keystroke, and acts like the standard ctrl+r ...
1
vote
0answers
34 views

Searching in man pages [duplicate]

Recently, I stumbled over some configuration files. To gather more information about its structure and how the its used, I either do a quick research on the internet (just ask Google) or use the man ...
0
votes
1answer
186 views

How do I search for files from the gnome GUI in debian?

I sometimes spend time in the standard classic gnome GUI in debian wheezy, and today I wanted to search for files containing some text in a certain folder. I tried to do it the windows way by going ...
2
votes
0answers
91 views

KMail: Search for messages with attachment

How can I search for messages with one or more attachments in KMail? The search filters don't show such an option, and when selecting "Message Status" there also isn't a criteria for attachments. ...
4
votes
2answers
564 views

Replace very long string in files recursively

I have a very long and complex string in many files and I want to remove/replace it recursively. The string contains many slashes, backslashes and spaces and any kind of special signs. How do I do ...
1
vote
2answers
61 views

search and replace string

I have a XML tag for example <tag name="abc"></tag> I wanted to replace the string inside "" with the tag name i.e the upper XML tag should be become now <abc ...
0
votes
2answers
97 views

How to count number of instance of a word starting at another word

I need to grep the MySQL-error log starting at today's date formatted like: `date +"%y%m%d"` (140710) And look for all instances of the word partitioned. I've tried various things to no avail. ...
3
votes
2answers
1k views

Find and replace different columns using awk

I try to make a change in a file: Find a certain value and substitute it with another value in a different column using awk. Input (UiO-66Zr-EH.mof): unit ntype qqatom 1 'Zr1' 0.0d0 vibration ...
0
votes
1answer
220 views

How to copy contents of command line search result in unix to a file?

I would like to accomplish the following. Copy the contents of all search results into a single file. I don't want to copy the search result but the file contents of the search result. For example ...
2
votes
3answers
3k views

searching multiple strings in multiple files inside a directory and printing the string and corresponding file name where it was found

I have around 500 strings and I want to search for the files which contain them inside a directory and get the file names which contain the strings. So far I've been using: find -name 'LYFNRE.*' ...
11
votes
3answers
291 views

Search for man pages which contain ALL of the words 'foo' 'bar' and 'baz'

I'd like to search for man pages which contain ALL of the words 'foo', 'bar' and 'baz'. If possible, I'd like to search through all text (not just name & description) of all man pages. I'm ...
2
votes
1answer
75 views

updatedb for a beginner

The updatedb command, as I understand it, is basically the utility that keeps the mlocate.db database file updated. And it's a good idea to keep it updated regularly. For that matter, I've kept a ...
1
vote
1answer
19 views

Can't search for flags in qalter's man page?

I was trying to find out what qalter's -r flag does, but I can't search for -r when viewing the man page for it (pattern not found). Yet it's clearly there. If you scroll down a bit you'll see it. Why ...
2
votes
1answer
65 views

Exiting a '&pattern' search in less

After using a search in less of the format &pattern, which displays only matching lines, how can I go back to displaying all lines in the file? Esc doesn't do anything as far as I can tell. ^C ...
14
votes
1answer
313 views

Is there a way to search manpages for typical use scenario?

I have a relatively small brain, so there is a limit to what I can store up there. I have been using Linux semi-pro-amateur for a few years and still I am amazed at how little commands I know. Simple ...
0
votes
4answers
620 views

Search for a Value only in one column w.o using awk, sed, or perl

I have a file that looks like this : Marketing Ranjit Singh FULLEagles Dean Johnson Marketing Ken Whillans FULLEagles Karen Thompson Sales Peter RobertsonPARTGolden ...
5
votes
1answer
144 views

Highlighting text in bash when using reverse history search using Ctrl-R

Using Ctrl-R, I can search the history in bash. But what to do, If I want to highlight the relevant word which has been typed upon by me. Example: (reverse-i-search)`mount': sudo mount /dev/sda2 ...
1
vote
7answers
2k views

Can grep be used for searching files with some string in their names?

I understand that grep can only be used for searching for files which contain a string in their content. Can it be used for searching for files with a string in their names? I read the manpage, and ...
1
vote
1answer
304 views

'ipkg search xxx' always returns no answer

On a Synology NAS (uses a 'home grown' *nix variant (possibly based on Debian?)) I have installed ipkg package manager. When I try a command like ipkg search shred or ipkg search *shred* it ...
2
votes
2answers
2k views

How to search and replace strings matching a replacement list for multiple files

I have a file, say map.txt, containing a list of search strings and corresponding replacements: search -> replacement bigBone -> bb fishMarket -> fm dogCollar -> dc ... I need to ...
1
vote
2answers
4k views

How can I use grep to search multiple unnested directories?

It may sound like I'm asking the same thing as this question, but I have different requirements. This is an example of my filesystem: /code/ internal/ dev/ main/ public/ dev/ main/ release/ ...
8
votes
3answers
160 views

Can I force `man` to do lower case sensitive matching?

When I search man pages, the search is case sensitive, but only with regard to upper case letters. E.g., x will match x and X whereas X only matches x. This is the man-db version of man, used on ...