Questions tagged [sed]

Sed, developed at Bell Labs in the mid-1970s, is a versatile command line editor designed for POSIX environments. By processing files using an editing script and then outputting the results to standard output, Sed has become a reliable tool for developers and system administrators alike.

Ways to eliminate unnecessary quotation marks surrounding a string in a JSON file using a shell script

I need help removing extra quotation marks from the following JSON data: {""id"":""1"", ""name"":""john"",""address"":"",""timestamp"":""2018/01/01 12:43:42 -700"",""dept"":""} To address this issue, I have been using the sed command: sed -i -e 's/ ...

Encountering a glitch while attempting to generate a fresh Kubernetes configuration file using NodeJs and sed

My approach involves utilizing the Shelljs and sed command to create a new K8S configuration file shell.exec(`sed -e s%${server}%${endpoint}%g -e s%${certificate}%${cert}%g config-temp`) shell.exec("cat config-temp | tee config") Subsequently, I validate ...

Retrieve lines from a document that fail to meet specific requirements

To tackle the issue, my goal is to extract lines from a file that do not contain the specific pattern: "ddd":[ The target is to filter out lines like "memo": { or "notice": "delivered on 17", and only retrieve lines containing "ddd":[, disregar ...

Is it possible to use a shell script to replace the external CSS file link in an HTML file with the actual content of the CSS file

Seeking a solution for replacing external CSS and JS file links in an HTML document with the actual content of these files. The current structure of the HTML file is as follows: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C ...

Searching for a method to locate and substitute a specific HTML string using the `sed` command in the macOS Catalina terminal

I am attempting to modify the following html code: <svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="0 0 256 256"> to this updated version: <svg xmlns="http://www.w3.org/2000/svg" width="30&q ...

Transforming numerous key-value pairs into JSON formatting: utilizing sed in conjunction with an awk for loop

I am currently working with a data file that has 8 columns delimited by pipes. The last column contains an unpredictable number of key-value pairs, each separated by the equals sign and spaces between each pair. However, the challenge is that the values wi ...

Matching patterns and removing four lines that match the specified pattern

I currently have 2 separate files that I am working with. Within File 1, there is an Identifier (e.g. DF:1:1) as well as an additional field of "1:N". The following 3 lines are specific to the given Identifier. File 2 contains a column of various Identifie ...

To identify a specific field within a JSON file by cross-referencing it with a plain text file and extracting the corresponding values

Having two files, file1.json and a plain text file called file2. I need to compare the values in file2 with the values in file1.json and extract the corresponding CaseID from file1 based on matching values. Below are some cases along with the expected resu ...

sed is not able to pick out the values

Looking for assistance with the sed command. I am trying to extract JSON values and assign them to variables using sed. Can someone provide guidance on how this can be achieved? For example: echo "{url:news.google.com,int:3}" | sed ? url=news.google.com ...