How would you parse in bash #extra_modules <string> [closed] - regex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How would I parse
#extra_modules some string
in kdump.conf file to get "some string" as actual output in bash script ?
Thanks !

grep "#extra_modules" kdump.conf | cut -c 16-
grep finds the lines with the phrase "#extra_modules", and cut selects all the characters after the first space

Related

String conversion and concatenation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I have the following line of XML:
<indexentry><secondaryie>definition, 3/2/4</secondaryie></indexentry>
And I need a regex that matches the above and converts it as below:
ABC3(the first number)/P-2(second number)-4(third number)
How can I do this?
Use this regex:
([0-9]+)/([0-9]+)/([0-9]+)
And from captured groups #1, #2, #3 make your string:
ABC3\1/P-2\2-4\3

Extract the email address, and replacing a character using Regex [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying to come up with Reg ex expression that would match an email address starting with format E- and replacing the "AT" with an actual "#" sign.
Here is an example:
E-CANAD.JACK AT EXAMPLE.COM.
The desired output will need to look like CANAD.JACK#EXAMPLE.COM.
Replace:
[eE]-([a-zA-Z0-9]+(?:[._-][a-zA-Z0-9]+)*) (?:at|AT) ([a-zA-Z0-9]+(?:[._-][a-zA-Z0-9]+)*[.][a-zA-Z]+)
By:
$1#$2
More:
Visualization by
Debuggex
Demo by RegExr
You didn't mention your language, so I'm assuming perl
s/^E-(.*) AT (.*)$/$1\#$2/;

Perl match in context [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to find a word in a text file, and save it to a variable along with some characters. for example in the text file it would be something like:
Isoelectric Point = 6.2505
I'll be looping through a directory of files, so the value of the Isoelectric Point will change, and that is why I need the characters after the match to be saved to a variable.
if (my ($point) = $str =~ /Isoelectric Point = (\S+)/) {
...
}

Scripts: how to remove hex strings in a text file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
The input file is like
<org.eclipse.core.runtime.adaptor.EclipseClassLoader#1c7d9114,Lorg/eclipse/core/
resources/ResourcesPlugin;>.<init>(Lorg/eclipse/core/runtime/IPluginDescriptor;)V
the goal is to remove hex strings like 1c7d9114,.
The length of the hex strings is fixed, that is 8.
please also include the immediate following comma.
Is there any simple script could deal with this?
Using sed:
sed 's/#[a-f0-9]\{8\},/#/' input
Using perl:
perl -pe 's/\#[a-f0-9]{8},/\#/' input.txt
Using awk:
awk '{gsub(/#[a-f0-9]{8},/,"#",$0)}1' input.txt

Search and Replace comment out entire line Java/Eclipse [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
Say I have a line
blah.field
that needs to be commented out
//blah.field
which is referenced in a project in multiple files
Is there a way to comment this line in all places using a simple eclipse search and replace?
Replace regular expression:
^blah\.field$
with
//$0
^ = begin of line (here)
$ = end of line
$0 = the entire found match