Skip to content
Advertisement

Tag: regex

Finding emails from one file in another

I want to find emails from one file listed as such: in another file listed as so: and output the lines from the second file that match with the first file also keeping in mind it needs to match the entire email from start to finish so it won’t match robertjohn@blogs.com accidently. Desired output: Thanks! Answer With grep, get the

Match unknown substring with RegEx

How can I get an unknown substring with an regular expression? I know what’s before and after the wanted string but I don’t want the known part with in the result. Example text: I’m looking for ‘SOMETHINGHERE’ and ‘SOMETHINGELSE’ only. vocher_ and .db are always before and after the relevant part but should not be in the result. A working

Using sed with regex to replace text on OSX and Linux

I am trying to replace some strings inside a file with sed using Regular Expressions. To complicate the matter, this is being done inside a Makefile script that needs to work on both osx and linux. Specifically, within file.tex I want to replace with (xxx and yyy are just example text.) Note, xxx could contain any letters, numbers, and _

Does hyphen need to be escaped in a regular expression?

The following returns a bunch of results including those containing “->emit” But the following returns no results Why? Answer You need to drop the -w option. It says to treat the expression as a whole word. A word must be bounded by non-word characters, i.e. it must only be surrounded by characters other than [a-zA-Z0-9_]. emit would match emit, _emit,

Extract class names from JAR with special formatting

How would I extract all the available classes from a Jar file and dump the output, after some simple processing, to a txt file. For example, if I run jar tf commons-math3-3.1.6.jar a subset of the output would be: I would like to convert all / to . And all $ to . Finally I would also like to remove

how to replace decimal in linux

I have a csv file with error in one field, the fields are separated by “,” but the error is in decimal field, for example 34.25,” i need replace by 34.25″,”. Search ,” and replace by “,” is not option, others fields will modified. Answer Check that the character before ,” is not a double quote, and if it’s not,

How Do I Fix This SED Command to Find & Replace a String

Good-day, I’m working on a Bash script for Debian Jessie and in this line; I am trying to find base_dir}/scripts and replace it with script_dir} so that my new line will read as: This is what I have tried so far; which results in this error; I am confused as to how to resolve this and would appreciate some assistance

Advertisement