Tagged Questions
8
votes
7answers
3k views
How to move multiple files at once to a specific destination directory?
I got a bunch of files in some directory (along with many other files) that I want to move.
Luckily, all the files I want to move contain a certain identifier in their names, so I can ls | grep ...
5
votes
2answers
221 views
Grep through subdirectories
Add a string to a text file from terminal
I've been looking at this thread. The solution (number 2, with ls grep) works perfectly for files called .txt in the current directory. How about if I wanted ...
3
votes
2answers
809 views
How Do I fetch only the numbers in grep?
I have file like this :
other lines . . .
blah blah blah (:34)
I wish to find the occurrence of numbers in the above file. I came up with :
grep [0-9] filename
But that is printing the ...
2
votes
4answers
157 views
How do I find matching filenames in a directory listing?
I have bunch of ISO images in my hdd and I have their whole content listed inside a text file in the following format:
<immage>.iso, <dir structure>/<filename>.<extension>
...
0
votes
2answers
276 views
How do I copy files that I just searched for via the command line?
Using Ubuntu 12.04 I need help on copying files that were returned from a search with grep .
I have many pdf files, so to filter specific named files I am using General grep command as
follows.
...
0
votes
1answer
607 views
How can I recursively check folders with flac files for corruption?
Something caused to damage some of my flac files, and to find out which ones I need to rerip, I would like to get a list containing only the damaged files.
How I do it now: Open a terminal in a ...
1
vote
2answers
381 views
grep invalid option on ubuntu
I've already removed and reinstalled grep on Ubuntu but still the same error persists.
Whatever grep command I type I always see the following output:
grep: invalid option -- '='
Usage: grep ...
0
votes
1answer
83 views
How do I grep audio/video frame time indexes from an XML file?
I have a xml file like this:
<field name="frame.time_delta_displayed" showname="Time delta from previous displayed frame: 0.000000000 seconds" size="0" pos="0" show="0.000000000"/>
<field ...
0
votes
1answer
205 views
Attempting to GREP details of a Java error
I'm running Ubuntu 11 and I'm having some issues with grep.
I have a shell script (see below) which essentially checks if a certain Java program of mine is running, if not it runs it. That part works ...
15
votes
2answers
1k views
How does this [t]ricky bracket expression in grep work?
I saw this one-liner recently:
$ ps -ef | grep [f]irefox
thorsen 16730 1 1 Jun19 ? 00:27:27 /usr/lib/firefox/firefox ...
So it seems to return the list of processes with "firefox" ...
0
votes
2answers
157 views
Cat a command to file
My bash script does many things, among which creating another script. I would like to have the following line to be executed from within a script. But it does not work (grep is executed instead of ...
4
votes
2answers
969 views
Is there a way to do a ' ls -R | grep “aname”* | rm; to remove multiple files in multiple directory
I have installed (compiled) emerald. The command make uninstall didn't work (there is no makefile as it is just a script). So I decided to remove the file manually. But there were a lot of files.
...
11
votes
6answers
542 views
How can I grep through tab completion possibilities?
When I press tab in a console I get this output
Display all 2957 possibilities? (y or n)
Is there any way to use grep on these 2957 possibilities? I would like to search for all commands with ...
7
votes
3answers
2k views
How do I combine multiple grep commands?
I have a command like this:
| grep -v @param | grep -v @return | grep -v @Test | grep -v @throws
and its getting bigger, is there any way to make this neater?
2
votes
4answers
236 views
How to grep whole manual?
I can do for example
man cp | grep verbose
to findout if cp man has word "verbose", how can I do something like (pseudo-code)
man * | grep copy
to find out what command to use for coping?
1
vote
1answer
3k views
How to get line number from grep?
the fallowing grep
grep -r -e -n coll *
will display
fullpath/filename: <tag-name>coll</tag-name>
I would like to know what line has the fallowing text, I tried adding -n, but it ...
1
vote
1answer
183 views
bash text processing and error message
for example I have this script that kills firefox
ps x | grep firefox | grep -v grep | awk '{print $1}'| xargs kill -9
but when there is no firefox running it spits out:
Usage:
kill pid ... ...
1
vote
2answers
471 views
how to use grep in a conditional search previous to a sed text replace command
I am trying to change the path in whole lot of m3u files.
I know I can do it with regexxer f.e. but I'm trying to learn bash.
This is the command I figured out, but it is not working.
grep -lr -i -e ...
17
votes
3answers
8k views
How to grep for tabs without using literal tabs and why does \t not work?
When I search for tabs in a file with (e)grep I use the litteral tab (^v + <tab>). I can not utilize \t as a replacement for tabs in regular expressions. With e.g. sed this expression works very ...
2
votes
4answers
187 views
Find and bash problems in recent Ubuntu versions
I've been having a problem the last six months or so when combining searches in bash. The exact example is related to Python programming but would apply to any kind of detection/manipulation.
Suppose ...
3
votes
1answer
391 views
Problem manipulating text using grep
I want to search for a line that contains log4j and take 7 lines before and 3 lines after the match.
grep -B7 -A3 "log4j" web.xml
After that I want to add comment tags before this paragraph and ...
15
votes
2answers
4k views
How to grep 2 or 3 lines, one containing the text I want, and the others just below it?
This is a snapshot of error log:
06:16:29,933 ERROR EmailRMManager$:45 - Exception In get Message
com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed ...
3
votes
3answers
2k views
using grep with pipe and ampersand to filter errors from find
I am using cygwin to find a file on the cygdrive.
However I need to suppress the permission denied messages (otherwise the results get hidden in the error messages). The following command works:
...