Skip to main content

Questions tagged [sed]

sed is a command line editor for POSIX environments. It processes one or more files according to an editing script and writes the results to standard output. Created at Bell Labs, it has been around since the mid-70s.

sed
0 votes
2 answers
55 views

BASH: Assign values to variables with echo | sed | read [duplicate]

I'm trying to pass a string through a pipe going from echo to sed to read, but something isn't working: #!/bin/bash STR="alef|bet|gimel|daled" echo $STR echo $STR | sed 's/\|/ /g' | read ...
Akira Takeshi's user avatar
2 votes
5 answers
41 views

Delete line containing pattern in between specific range of lines

I want to completely remove lines containing a pattern ignoring first few lines. I tried: $ sed -i '2,$s/pattern/d' file.txt but it says unterminated's' command. For example I have a file: pattern # ...
k1r1t0's user avatar
  • 735
2 votes
0 answers
30 views

Correct Syntax for Using sed Command in GitLab CI

I'm currently working on a GitLab CI/CD pipeline and I'm trying to use the sed command to dynamically update the contents of a file while the pipeline is running. My goal is to replace a placeholder ...
Hexca's user avatar
  • 21
0 votes
1 answer
54 views

SED --- in a string, replace word1 by word2 after token 1 --- replace only once

input string : PARAM Piece of code that did not work. PARAM="0 \" 0 - ${TEXT0}\" off 1 \" 1 - ${TEXT1}\" off 2 \" 2 - ${TEXT2}\" off 3 \" 3 - ${TEXT3}\&...
jcdole's user avatar
  • 67
1 vote
3 answers
67 views

sed - Posix compliant generic multiple insert/appends single command

I'd like to perform multiple inserts/appends in a single sed command that is portable. In GNU sed, I can do something like: sed -e '1i hi' -e '$a bye' <(seq 1 10) I've the found the following works,...
Adam D.'s user avatar
  • 191
0 votes
1 answer
26 views

The fields replaced with sed - i in PowerShell contain special characters [duplicate]

I need using the Sed to update some string in the Json files. However, due to the presence of special characters in the field, the replacement has not been successful: The string which should be ...
Joy's user avatar
  • 1,215
0 votes
1 answer
39 views

sed command is not replacing the files in my directory [duplicate]

When I run my bash script(given below) the files are not changed. The replacement does not happen for some reason. I am running the command as sudo, and the html folder has permssions 775 with the ...
Gavin Mitchel Dundee's user avatar
-1 votes
1 answer
40 views

Sed command ubuntu terminal [closed]

I'm trying to figure out how to do this on Ubuntu Terminal console. I have this file /home/users/user/config.cfg and I need every 24 hours replace 1 specific text that repeats many times on each ...
JaTamez's user avatar
  • 11
-1 votes
0 answers
22 views

When I try to change a variable in a file I stack with error [duplicate]

I have two bash files: 1: #!/bin/bash PATH="/home/jk/go/src/emdr/emd_server" sed -i 's|^COMPOSE="[^"]*"|COMPOSE="'$PATH'/docker_compose.yml"|' "$PATH/up/...
Neverhood's user avatar
-3 votes
0 answers
44 views

Output lines from a file that match pattern 1 and not pattern 2 in linux [duplicate]

I have a text file that has a bunch of lines. I used grep to print lines matching pattern 1 to a second file. I want to modify the command to exclude the lines the match pattern 2. So the requirement ...
Ananya1's user avatar
-1 votes
3 answers
107 views

How to find strings in multiple lines of txt file then add all to new csv line

I have thousands of txt files that were converted from emails that included a "Contact Us" form. I need to find/select strings in the second "column", but the number of lines to ...
Aidbfbx's user avatar
1 vote
4 answers
85 views

Duplicating entries in textfile for empty entries until a non-empty entry is found, then continue with the new entry

I have a very large textfile in which some entries are missing. The logic is persistent, as the first line of each "section" has the correct entries, every line after this initial line is ...
Stefan M's user avatar
  • 879
2 votes
5 answers
82 views

How to insert a character in front of a line one line above a specific character?

In my text file there are many lines whose contents are almost the same. Here are some of them. So, what I want is to overwrite the / with - on every line and then insert - in front of the line ...
kuninox's user avatar
  • 25
0 votes
0 answers
37 views

capture hash value from git log --oneline --graph using regex [duplicate]

When running git log --oneline --graph you can get something like this * 7e5dbb0 Merge |\ | * c873a96 My | * f5817ba Amazing * | f6a34ac Feature |/ * f5a51ce Other stuff I want to take that and ...
Net-worker's user avatar
1 vote
4 answers
113 views

Awk /Sed or TCL script to search series of patterns

I am having one File as stated below File 1 Module1 (a dd ddd ) jdjd ikdnd kdndn didkdn; jdjdjl kdkdk kdkd lkd; Ann {"Load DR"} ; V { REST_TMS=1 ; REST_TDI = 0 REST_TCK=1 ; ...
kshitij kulshreshtha's user avatar

15 30 50 per page
1
2 3 4 5
1925