Hello
I want to attach to a running process using 'ddd', what I manually do is:
# ps -ax | grep PROCESS_NAME
Then I get a list and the pid, then I type:
# ddd PROCESS_NAME THE_PID
Is there is a way to type just one command directly?
Remark: When I type ps -ax | grep PROCESS_NAME, grep will match both the process and grep command ...
Hello All,
I want to be able to take the files I found with my first grep statement, something like this for example:
grep -r Makefile *
And then pass the files found in that pass of grep to a second grep with something like this for example:
grep {files} '-lfoo'
How do I do this? I know there must be a way.
Thank you.
...
I am using the following command to grep stuff in subdirs
find . | xargs grep -s 's:text'
However, this also finds stuff like <s:textfield name="sdfsf"...../>
What can I do to avoid that so it just finds stuff like <s:text name="sdfsdf"/>
OR for that matter....also finds <s:text somethingElse="lkjkj" name="lkkj"
basically s:text an...
i have a huge .java file and i want to find all declared objects given the className. i think the declaration will always have the following signature:
className objName;
or
className objName =
or
className objName=
can someone suggest me a grep pattern which will find these signatures. I have the following (incomplete) :
...
I have HTML content stored in a variable. How do I extract data that is found between a set of common tags in the page? For example, I am interested in the data (represented by DATA kept between a set of tags which one line after the other:
...
<td class="jumlah">*DATA_1*</td>
<td class="ud"><a href="">*DATA_2*</a></td>
...
And then I...
I'm using grep to filter the Mac OS X dictionary words file (by default located at /usr/share/dict/words).
I want to use grep to retrieve all words four characters long. How do I do this?
My best guess for how to do this was:
grep [:alpha:]{4} words
But that returns zero results.
...
Hi,
How to properly construct regular expression for "grep" linux program, to find all email in, say /etc directory ?
Currently, my script is following:
grep -srhw "[[:alnum:]]*@[[:alnum:]]*" /etc
It working OK - a see some of the emails, but when i modify it, to catch the one-or-more charactes before- and after the "@" sign ...
grep...
I have an HTML file and I am interested in the data enclosed by <pre> </pre> tags. Is there a one-liner that can do achieve this?
Sample file :
<html>
<title>
Hello There!
</title>
<body>
<pre>
John Working
Kathy Working
Mary Working
Kim N/A
</pre>
</body>
</html>
Output should be :
John
Kathy
Mary
Kim
Much appreciat...
Hello,
I have a grep expression using cygwin grep on Win.
grep -a "\\,,/\|\\m/\|\\m/\\>\.</\\m/\|:u" all_fbs.txt > rockon_fbs.txt
Once I identify the emoticon class, however, I want to strip them out of the data. However, the same regexp above within a sed results in a syntax error (yes, I realize I could use /d instead of //g, but t...
hi. maybe it's a bit strange - and maybe there are other tools to do this but, well..
i am using the following classic bash command to find all files which contain some string:
find . -type f | xargs grep "something"
i have a great number of files, on multiple depths. first occurence of "something" is enough for me, but find continue...
When searching for number of occurrences of a string in a file, I generally use:
grep pattern file | wc -l
However, this only finds one occurrence per line, because of the way grep works. How can I search for the number of times a string appears in a file, regardless of whether they are on the same or different lines?
Also, what if I...
There are often times I'll grep -n whatev file to find what I'm looking for. Say the output is
1234: whatev 1
5555: whatev 2
6643: whatev 3
If I want to then just extract the lines between 1234 and 5555, is there a tool to do that? For static files I have a script that does wc -l of the file and then does the math to split it out wi...
I have a file containing a lot of SQL statements, such as:
CREATE TABLE "USER" (
"ID" INTEGER PRIMARY KEY,
"NAME" CHARACTER VARYING(50) NOT NULL,
"AGE" INTEGER NOT NULL
);
COPY "USER" (id, name, age) FROM stdin;
1 Skywalker 19
2 Kenobi 57
I want the column names in the COPY statements to be uppercased and quote...
I have deleted a file or some code in a file sometime in the past. Can I grep in the content (not in the commit messages)?
A very poor solution is to grep the log:
git log -p | grep
However this doesn't return the commit hash straight away. I played around with "git grep" to no avail.
...
Hi,
I want to create a script that checks an URL and perform an action (download + unzip) when the "Last-Modified" header of the remote file changed. I thought about fetching the header with curl but then I have to store it somewhere for each file and perform a date comparison.
Does anyone have a different idea using (mostly) standar...
I have the following command that I run on cygwin:
find /cygdrive/d/tmp/* -maxdepth 0
-mtime -150 -type d |
xargs du --max-depth=0 > foldersizesreport.csv
I intended to do the following with this command:
for each folder under /d/tmp/ that was modified in last 150 days, check its total size including files within it and ...
I'm writing a git-install.sh script:
http://gist.github.com/419201
To get Git's latest stable release version number, I do:
LSR_NUM=$(curl -silent http://git-scm.com/ | sed -n '/id="ver"/ s/.*v\([0-9].*\)<.*/\1/p')
2 Questions:
Refactor my code: Is there a better way programmatically to do this?
This works now, but it's brittle: if...
more file
param1=" 1,deerfntjefnerjfntrjgntrjnvgrvgrtbvggfrjbntr*rfr4fv*frfftrjgtrignmtignmtyightygjn 2,3,4,5,6,7,8,
rfcmckmfdkckemdio8u548384omxc,mor0ckofcmineucfhcbdjcnedjcnywedpeodl40fcrcmkedmrikmckffmcrffmrfrifmtrifmrifvysdfn drfr4fdr4fmedmifmitfmifrtfrfrfrfnurfnurnfrunfrufnrufnrufnrufnruf"****
need to match the content of p...
I try to sum the traffic of diffrent ports in the logfiles from "IPCop" so i write and command for my shell, but i think its possible to optimize the command.
First a Line from my Logfile:
01/00:03:16 kernel INPUT IN=eth1 OUT= MAC=xxx SRC=xxx DST=xxx LEN=40 TOS=0x00 PREC=0x00 TTL=98 ID=256 PROTO=TCP SPT=47438 DPT=1433 WINDOW=16384 RES=...
I want to grep an environment variable
env | grep ABC_IJK[1,2]
currenlty defined variables are like this
ABC_IJK1=123
ABC_IJK1_XYZ=sn123:345
ABC_IJK2=999
ABC_IJK2_XYZ=sn321:999
I only want to get only this
ABC_IJK1=123
ABC_IJK2=999
get number of connections sum them(not 123 + 999) and save in N1 (this one has 2 connection)
...