sed

Gnuplot: line 0: no previous plot

Gnuplot: line 0: no previous plot Question: I am trying to save the Gnuplot plot in PNG that I get with my SDR and a tool named rtl_power_fftw. This command displays my plot on the screen but I want to save it in PNG: rtl_power_fftw -f 900M:950M -n 10 -b 512 -q | sed -u …

Total answers: 1

Updating python variable name using Sed in shell script

Updating python variable name using Sed in shell script Question: I have a py file where we need to update the value of a variable table_name from a shell script using sed. The value will be like $ENV_NAME_ref_table considering we have already exported ENV_NAME as export ENV_NAME=’staging’. What should be the sed command? I have …

Total answers: 1

adding language to markdown codeblock in bulk

adding language to markdown codeblock in bulk Question: My Problem is to add to every single block of code a language in my markdown files. I’ve hundreds of files in nested directories. The files have this form: “`language a “` Normal text “` b “` Normal text “` c “` Normal text “`language d “` …

Total answers: 1

convert file with multiple lines into array

convert file with multiple lines into array Question: How can I convert a file like: ap-southeast-1 ap-southeast-2 ca-central-1 into: "ap-southeast-1","ap-southeast-2","ca-central-1" What I tried so far: sed -z ‘s/n/,/g;s/,$/n/’ filename Above gives: ap-southeast-1,ap-southeast-2,ca-central-1 Tries xls transpose function but that also no luck: https://support.microsoft.com/en-us/office/transpose-function-ed039415-ed8a-4a81-93e9-4b6dfac76027 Asked By: Kiran Kumar || Source Answers: Extending OP’s current sed: $ sed …

Total answers: 4

Putting brackets around a specific column

Putting brackets around a specific column Question: With a bash script, I extracted a .conllu file into a three columned .txt with the Lemma, POS and meaning. So some kind of dictionary. Now I am trying to make it prettier by putting the second column (POS) in brackets. It looks like: ami NOUN mother amo …

Total answers: 2

Bash script get version from setup.py or from PKG-INFO file and export as environment variable

Bash script get version from setup.py or from PKG-INFO file and export as environment variable Question: I need to get version value from setup.py or from PKG-INFO using bash and extract environment variable with the version value for later use. (Actually I need version value for GitHub Action) from setuptools import setup, find_packages with open("README.md", …

Total answers: 3

Python like sed using regexes

Python like sed using regexes Question: Let’s say, that I have: string= ‘{‘id’: ‘1’}’ and now using strings like in Perl/sed I would like to get string=id (in Perl it would look like string=~s/{‘([a-zA-Z0-9]*)’.*$)/1/) Could you please give me a little insight how to do that in python? I expect that the regex syntax will …

Total answers: 2

How to use python regex to replace using captured group?

How to use python regex to replace using captured group? Question: Suppose I want to change the blue dog and blue cat wore blue hats to the gray dog and gray cat wore blue hats. With sed I could accomplish this as follows: $ echo ‘the blue dog and blue cat wore blue hats’ | …

Total answers: 4

What are the differences between Perl, Python, AWK and sed?

What are the differences between Perl, Python, AWK and sed? Question: What are the main differences among them? And in which typical scenarios is it better to use each language? Asked By: Khaled Al Hourani || Source Answers: I wouldn’t call sed a fully-fledged programming language, it is a stream editor with language constructs aimed …

Total answers: 5