Category "sed"

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

Bash sed command issue

I'm trying to further parse an output file I generated using an additional grep command. The code that I'm currently using is: ##!/bin/bash # fetches the links

How to shift a specific cell left in a text file

I have a very large text file (tab-delimited, first line is header) like this: A1 A2 A3 A4 A5 A6 A7 FA1 AB 234 231 0.02 456 I FA2 ACE 241 2154

To replace a immediate text after pattern match in Linux shell using sed

Content of a json file "iso_checksum": "md5:32fdf4fef4ef" I have stored value of new checksum in a variable v = "4dfv45ffdf" I want to replace the value after

How do I get only names of active plugins in Wordpress?

I am trying to to get list of active Wordpress plugins and for that I am using wp plugin list --status=active --allow-root command. That gives me putout like t

How to properly pass filenames with spaces with $* from xargs to sed via sh?

Disclaimer: this happens on macOS (Big Sur); more info about the context below. I have to write (almost did) a script which will replace images URLs in big text