Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
-2 votes
4 answers
101 views

How to append some static content within a single cell of an existing CSV file

Let's assume I need to append the below content within the first cell (not be row by row) of the existing CSV file which has details of the customer. How can I achieve it? Content to be added: "...
Loganayaki mahalingam's user avatar
2 votes
3 answers
70 views

Using sed to remove differences in two arrays (updated ssh keys)

My aim is to updated automate the update of ssh keys in the authorized_keys file. Due to restrictions i am unable to use ansible which would have been a lot simpler. Steps: read keys from the file ...
Drey''s user avatar
  • 25
-1 votes
5 answers
114 views

How do I delete all the lines that match and one after each of them?

I have a large file and a list of my specific strings. The output should not contain my specific lines and one more after each of them. 2 consecutive matches are impossible due to structure of file ...
Женя Гончаров's user avatar
-1 votes
2 answers
77 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
49 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
0 votes
1 answer
57 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
0 votes
1 answer
41 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
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
-1 votes
3 answers
109 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
86 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
85 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
38 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
0 votes
1 answer
60 views

sed command changing while robot tests are runs

I am running a sed command within robot test: ${stdout01}= Run echo ${stdout0} | sed "s/\'/\"/g" It is not running properly and giving me error: /bin/sh: 1: Syntax error: ...
Nav89's user avatar
  • 71
-5 votes
7 answers
173 views

Replace delimiter in the file

Let's take "apple" , "tomato,potato", 100, 250, "banana" is my data I want replace the outer delimiter i.e. , which is same as inner delimiter. Ultimately, want my data ...
Phantom's user avatar
0 votes
3 answers
37 views

Remove prepending character from block of lines in bash

I have a text file that has at some point a text like this: [....previous text...] #[ID1] #my_url="http://miccheck12.com" #your_url="http://miccheck12.com" #comments="" ...
roschach's user avatar
  • 9,044

15 30 50 per page
1
2 3 4 5
823