I'm looking in our code for something that looks very much like:
#$foo="bar";
$foo="baz";
Problems:
I don't know the name of the variable
I don't know which line is actually commented out.
I really don't seem to be able to properly write a multi-line regex.
My initial attempt was ack /\$(.\*)=.\*$\$($1)=/
I prefer ack usually for...
I'm using wget to create static copies of my site however there are several elements which require external assets that are pulled in via javascript. The pattern of the script should be fairly constant and no urls are dynamically created. The urls I need to extract look like :
onclick="return ns.homepage.load({e:this, src:'https://mysub...
Heya guys, I have this small script and i need to grep all the files and leave only the ones that contain a keyword and I'm stuck on this, any help in pointing out my dumb errors is appreciated :)
#!/bin/bash
server=(server1...server24)
.
.
.
for ((n=0; n <= 24 ; n++))
do
if grep -q "KEYWORD" directory/${server[$n]}.html ; th...
I want to filter out several lines before and after a matching line in a file.
This will remove the line that I don't want:
$ grep -v "line that i don't want"
And this will print the 2 lines before and after the line I don't want:
$ grep -C 2 "line that i don't want"
But when I combine them it does not filter out the 2 lines befor...
I have folders with the naming convention:
yearmonthday_jobcode_descriptor
ie 20101007_GR1234_Whatsit
I'm attempting to write a script that does a few things:
move any folders where the date is older than $X into ./old
move any folders where the date is in the future ./old
move any folders that dont conform to the convention ./old
d...
I have two files
File 1:
7118
7457
7591
7539
8001
File 2:
5003
5008
5011
5026
5028
5029
5031
Output that i need
7118,5003
7457,5003
7591,5003
7539,5003
8001,5003
7118,5008
7457,5008
7591,5008
7539,5008
8001,5008
so on.....
...
So my dear SOers, Let me be direct to the point:
specification: filter a text file using pairs of patterns.
Example: if we have a file:
line 1 blabla
line 2 more blabla
line 3 **PAT1a** blabla
line 4 blabla
line 5 **PAT1b** blabla
line 6 blabla
line 7 **PAT2a** blabla
line 8 blabla
line 9 **PAT2b** blabla
line 10 **PAT3a** blabla
line 1...
Hi All,
simple question, what is the option for grep that will allow me only to print the matching file and not the line within a file that matches the criteria?
...
I need to download several files with wget and measure download speed.
e.g. I download with
wget -O /dev/null http://ftp.bit.nl/pub/OpenBSD/4.7/i386/floppy47.fs http://ftp.bit.nl/pub/OpenBSD/4.7/i386/floppyB47.fs
and the output is
--2010-10-11 18:56:00-- http://ftp.bit.nl/pub/OpenBSD/4.7/i386/floppy47.fs
Resolving ftp.bit.nl... 213...
Major bash-noob here. Writing my second program again. For my homework, I need to write a number of grep statements using regexps.
This is the first one I'm trying to write.
I'm saving it as grep.bash:
#!/bin/bash
egrep bright_side_of_life 'the'
The error I get is :
egrep: the: no such file or directory
...
One of my homework questions is to search using grep an lines that contain the word 'death' or 'breath'.
I know the [] operator acts as an or, but how do I use it to specify 'd' or 'br' ?
This won't work:
egrep [dbr]eath test_file
...
I want to search for all elements in an array which have the same starting set of characters as an element in another array. To make it clear:
@array = ("1a","9","3c");
@temp =("1","2","3");
I want to print only 1a and 3c. When I try to use the following program it prints out all the elements in the array instead of the two I want:
f...
[meder@kat directoryName]$ grep -RlI "send you instr" *
application/views/scripts/auth/forgot.phtml
[meder@kat directoryName]$
Is there a quick hack to referencing the only result? Can I somehow pipe it to vim?
...
I have file something like this
1111,K1
2222,L2
3333,LT50
4444,K2
1111,LT50
5555,IA
6666,NA
1111,NA
2222,LT10
Output that is need
1111,K1,LT50,NA
2222,L2,LT10
3333,LT50
4444,K2
5555,IA
6666,NA
1 st Column number may repeat anytime but output that i need is sort and uniq
...
I am using gvim grep that defaults to findstr in a Windows XP environment. The gvim has access to the folder where the error file is to be opened, but it fails. Is there anyway to change where the error file goes? Do you have any other tips/suggestions for using findstr in gvim for windows?
...
I'm trying to exctract error lines from my log file:
I used this :
more report.txt | grep -E (?i)(error)
I'm getting this error msg :
bash: syntax error near unexpected token `('
What am I doing wrong? I'm trying to extract all lines containing "Error" ignoring the case sensitivity so it can be error, Error, ERROR etc.
...
i can use
ls|grep \.py$
to list all ends with .py file,but it's seems hard for me to grep all .py & .txt & .tar.gz file once
any one could give me a hand
...
Hi,
I'm developing an application in RealBASIC, but I need the list of interface names to populate a dropdown box.
Parsing ifconfig didn't work (Got eth0, eth1, lo, etc...)
I need the name that is displayed in system preferences (Ethernet, Airport, etc...)
Is this possible in RealBASIC or is there a terminal command I can parse?
Than...
I'm using grep to match string in a file, here is example file :
example one,
example two null,
example three,
example four null,
grep -i null myfile.txt returns
example two null,
example four null,
How can I return matched line + line number like this :
example two null, - Line number : 2
example four null, - Line number : 4...
Hi,
I am given a log file(see below), I need to make it to this format using bash script:
title pdfspool date rip date bmpspool date CLAB date
Sometitle12 10/09/23 00:56:40 10/9/23 0:56:46 10/9/23 0:56:50 10/9/23 1:01:13
log file
!!Begin
Source aserver:pdf_spool:the, Job 844b015e0043469e, Inst 844b015e0043469e
T...