Regular expressions are a means of matching a pattern of characters within a string.
0
votes
2answers
41 views
bash - reading user variable into bash script grep
I've tried every possible combination to get this bash script working. It's part of a larger script, and it basically prompts for a username (to check if it exists) and returns the appropriate ...
3
votes
3answers
60 views
Remove string from a particular field using awk/sed
I have a file (>80,000 lines) that looks likes this:
chr1 GTF2GFF chromosome 1 249213345 . . . ID=chr1;Name=chr1
chr1 GTF2GFF gene 11874 14408 . + . ...
5
votes
3answers
164 views
difference between .* and * in regular Expression
I've a file named "test" that contains
linux
Unixlinux
Linuxunix
it's linux
l...x
now when i use grep '\<l.*x\>' , it matches :
linux
it's linux
l...x
but when i use grep '\<l*x\>' ...
1
vote
3answers
74 views
Trying to remove all ids from an HTML file with grep
I'm trying to remove all id=" "s from an .html file but I'm not sure where I am going wrong. I tried using regular expressions but all I am getting is the .html file rendering in my Ubuntu terminal.
...
1
vote
1answer
27 views
Trimming one part if equal to another part?
I use an e-mail quote attribution string like this:
On dd mmm yyyy hh:mm +hhmm, from [email protected] (Example Dot Org):
where [email protected] is the sender's e-mail address and Example Dot Org is ...
0
votes
1answer
32 views
(e)grep and atomic grouping [comprehension question]
I am trying to understand the correct use of »atomic grouping« a.k.a. »independent subexpressions« a.k.a. »non-backtracking subpattern« [this are the terms I found ...
0
votes
1answer
23 views
Comment the if statement and the matching endif keyword
In vim, I can find the matching if statement and prepend the appropriate comment symbol. (e.g. %s/.alarm./#\0/g), but then I am left with dangling endifs that I have to find manually. I could simplify ...
0
votes
2answers
73 views
what is “an invisible whitespace character that takes up space”
One can look up Unicode Characters with Regular Expressions. On Jan Goyvaerts website I found a RegExp whose meaning I don't understand :
\p{Zs} or \p{Space_Separator}: a whitespace character that ...
0
votes
1answer
27 views
How to highlight the whole log-line in color with multitail
I'm trying to use multitail to tail logs with color highlights. I defined a custom color scheme in multitail.conf, something like this:
colorscheme:my-color
cs_re:red:^\[E
cs_re:yellow:^\[W
...
4
votes
3answers
94 views
Delete XML node containing certain element
I want to remove all Placemarks from a KML file that contain the element <tessellate>. The following block should be wholly removed:
<Placemark>
...
0
votes
1answer
38 views
Regex awk to Cisco Interface
I would like to know if have some Sed/Grep or Awk regex to parse Cisco interface section, with specific attribute, like bellow.
Content of file.txt
!
interface FastEthernet0/1
no ip unreachables
!
...
3
votes
2answers
88 views
greedy and lazy regular expressions (comprehension question)
I am teaching myself regular expressions, and I got stuck at »greedy« vs. »lazy« repeatings.
What I found out so far is that
»greedy« means that the RegExp ...
4
votes
2answers
65 views
remove duplicate files
On my Mac OS X 10.6.7, iTunes duplicated every single file in my music library. Now I have 3,840 files instead of 1,920. The problem is that iTunes didn't simply duplicate the whole folder, but each ...
1
vote
3answers
101 views
Why is this Bash command using regex not replacing my brackets?
I have this command to go through all my files in my Music directory, and all subdirectories, and replace any square brackets in the file name with rounded brackets:
find /home/Music/ -depth -name "* ...
1
vote
1answer
54 views
Confused about word boundary
I have been researching this a lot, but I am still not clear on it. What does word boundary mean? What does it do?
So, for example, could someone explain this command to me please?
egrep ...