Category "sed"

Grep output based on regex: multiline with space bash

I have the following output from my command. I am trying to extract the id from the text if possible as a one liner # module.mongodb_atlas.mongodbatlas_proj

what is the best way to get target substring through regex in bash script

I am creating a script to automate and extract large amounts of text files; Currently, my problem is to get target id from .html files, example below: \ \ <

How to replace two strings as literals with sed?

I want to replace content: [], with content: ['./src/**/*.{js,jsx,ts,tsx}'], using sed and I'm trying this command: echo content: [], | sed -e s/content: \[\]/c

Vagrant machine wont run SED correctly - How to escape backslashes in Vagrant shell scripts

I have a problem I can't get around with vagrant provisioning. I have a file that has backslashes in it that I need to remove but Vagrant (Ruby?) just won't do

Sed command not working based on variable

I am having problems in execution a sepefic sed command. I have a bunch of files which will be target to several "find and replace" via sed. In the file_test th

Regular expression to capture alphanumeric string only in shell

Trying to write the regex to capture the given alphanumeric values but its also capturing other numeric values. What should be the correct way to get the desire

Using backticks to escape characters in sed with PowerShell running on Windows

I'm aware that, in PowerShell, backticks(`) are used to escape characters instead of the backslash(\). Hence, when using sed, this: echo '"where am I"' | sed "s

Get rid of single quotes from the substituted string within sed command in Python

I have a text file 1.txt which has following content: module abc I am trying to generate multi-line string that I need to add before module abc line in 1.txt.

Replacing first occurrence line after first matched line

Let's assume the following XML file: some text <addresses> <something/> </addresses> some more text <addresses xm

Find lines in a file that has only words in a list

Here is file1.txt: .apple .ball .cow .apple .cow .tea .mine.nice .mine.nice .tea .zebra Here file2.txt .apple .mine.nice .cow .tea Expected Result: .apple .co

How to replace 00 with Na excluding first row & first column using bash in comma separated file

I'm working with GWAS data, My data looks like this: IID,kgp11004425,rs11274005,kgp183005,rs746410036,kgp7979600 1,00,AG,GT,AK,00 32,AG,GG,AA,00,AT 100,TT,AA,00

Append text in front of variable within the same line - bash

I have this example.text > cat example.text 10.10.44.11 10.10.44.20 xa1-Y xa2-Y xb1-Y xb2-Y xc1-Y xc2-Y xd1-Y xd2-Y and I have this command: srxa_host_list

How do I extract two different keywords from two different lines in a file in bash shell?

I have a file called data.txt. when I read the file, the content looks like the below. $ cat data.txt name: linuxVol id: 6 type: Linux dir excludes: .snapshot*

edit the ID column to add chr to a number

I have a vcf file. It looks like this: It has a vcf header followed by genotype information. I want to add chr to third column. Like now it looks like: 21 98257

sed "unterminated `s'command`" error when running from a script

I have a temp file with contents: a b c d e When I run sed 's#b#batman\nRobin#' temp from command line, I get: a batman Robin c d e However, when I run the c

sed "unterminated `s'command`" error when running from a script

I have a temp file with contents: a b c d e When I run sed 's#b#batman\nRobin#' temp from command line, I get: a batman Robin c d e However, when I run the c

sed: delete n lines after first match

I want to delete N number of lines after the first match in a text file using sed. (I know most of these questions have been answered with "use awk", but I want

Delete ALL Regex Matched Line

this is my file: remark goes here MASS Pd 0.000 0.000 ATTN, need revision ns 14.010 0.530 same as n BOND Pd-cl

Extract string in brackets using grep/sed/etc?

I am trying to obtain a file location for PHP-FPM, using the following piped commands works: ps aux | grep php-fpm | grep master Results: root 80 0.0

Grep sorting dates [closed]

Each day I have to manually identify each stuck call by looking for calls with a date older than the current day. I have managed to grep the r