Questions tagged [replace]

The tag has no usage guidance.

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
49 views

Stuck With Using find and sed to Replace String in Filenames

Following this post as a reference, I'm able to run a find and sed command without it throwing an error, but the filenames remain unchanged. Trying to strip pronunciation_de_ from all mp3s in the ...
3
votes
0answers
308 views

KVM/QEMU hot-replace raw disk

One of VM disks got damaged and I'm trying to replace it online, without rebooting VM. However when I use: drive_add virtio1 file=/dev/sdb,format=raw,if=virtio,cache=none,aio=native in VM monitor ...
2
votes
2answers
598 views

Procedure to replace a hard disk?

One of the HDs in our Linux Mint computer has been behaving strangely (see at the end of the post, but it's not relevant) so we have decided to replace it. I would appreciate some advice on how to do ...
2
votes
0answers
179 views

History expansion in fish

I want to run the previous command with part of it replaced. In bash, I can use the history expansion feature: ^x^y runs the previous command again, except with x replaced by y. I tried it in fish and ...
2
votes
3answers
1k views

SED on Mac OS X

I'm using a MacBook Pro and I want to find and replace a given word with another with sed command, but it makes no changes. What is the problem? sed 's/\<cat\>/dog/g' tt.txt
2
votes
0answers
221 views

Automatic replacement of strings in gedit

I want to replace some strings defined by me in gedit, after a word has been completed and/or the document has been saved. For example \ðrac should be replaced with \frac How do I do this in gedit or ...
1
vote
2answers
34 views

Mass folder name correction - Calibre

I allowed Calibre access to my Library and it decided to change all my folder names adding (123) after every folder. (Replace 123 with random numbers.) What would be best command to use on Linux (...
1
vote
1answer
81 views

How to Replace a string by another in a text file

I would like to replace a given string in a text file into by another, but with one extra detail. Example: If the file content's is : Library Hello1 =============== any text here version: 0.1 ------...
1
vote
1answer
469 views

Replace a binary block within a large file

I have a partition image that contains a 1MB file populated with random data, and I would like to replace the contents of that file with another 1MB file populated with different random data. I have ...
1
vote
1answer
413 views

find and replace macro in libreoffice

How can I write a find and replace macro to merge many items in few, as "USA, Mexico, Canada, Honduras" in "America", "China, India, Vietnam" in "Asia" and so. Before macro: USA, Mexico, Canada, ...
1
vote
1answer
487 views

Find and Replace of All Names

Background I am new to linux/unix (I'm on a mac. Don't know which I am using), but someone made a lot of folders and files under the wrong name, and I need to go in and replace everything with the ...
1
vote
1answer
552 views

substitute complex text string in several files that contains special characters

I need to replace a complex string in several files in a directory. The string that needs replaced is: data:image/png;base64,...
1
vote
2answers
181 views

extract certain string, search and replace or keep a longer string contain the extracted value

The input file that needs to be edited is as below (can have more rows): bundle_id target_id length eff_length tot_counts uniq_counts est_counts eff_counts ambig_distr_alpha ...
0
votes
2answers
25 views

Storage disk info - Replace multiple Input values to output file

I would like replace below input about storage disk to an output in below presented format: Below script is almost working for me. But it doesn't work for T0. It seems is there problem with proper ...
0
votes
1answer
30 views

How to search for a newline that is not preceeded by } and remove it

I want to use sed to search for line breaks that are not preceded by }. The regex for identifying theses cases is: [^}]$ . What I want to say: If the line ended without } then remove the new line. ...
0
votes
1answer
244 views

regex to replace a word in a block in a file?

If I have: <Directory /> words allow bus </Directory> Is there a regex that can replace allow with something else and keep the other words and the block intact? So it should look ...
0
votes
3answers
149 views

Can I use sed/awk/etc to replace parts of a file with text from stdin?

I have a configuration script which does basically this: #!/bin/bash source vars.sh cat >foo.output <<EOF # some static stuff (many lines...) variable_bit=($SOME_VAR, $SOME_OTHER_VAR, ...) ...
0
votes
0answers
122 views

Why sed s acting differently on RedHat vs Mobaxterm using regexp?

I have a .txt file which includes "junk" characters, emojis. Example: 12/11/2015, 12:07 - 5465464: Super Wakkka👏🏻 12/11/2015, 12:30 - 89415: qwertz svima, nadam se 😊 12/11/2015, 12:34 - 55698742: ...
0
votes
1answer
64 views

DataPipeline - Repeated replace that has issues with sed (as explained) and needs to write files to new location

I need to perform a global (repeated) replace operation on the text of files recursively in a directory, but there are a few constraints that have given me issues: I need to replace in a way that ...
0
votes
1answer
42 views

Add the set of commands at the beginning of multipls files

I need to write a script for replacing a part of file with other. I am handling hundreds of files. I have a list of commands to be added to a bunch of text files. But in the files I have a common ...
0
votes
1answer
110 views

Emacs: query-replace prepend text to the found string

The scenario is that I am trying to append a new class to all the style declrations in my css file. So .oldclass{ float : left; } should change to .newclass .oldclass{ float : left; } The ...
0
votes
1answer
501 views

defining rename command scope; replace word; replace entire file name; wildcards

Im looking to use the rename command to edit file names. More specifically, Im trying to isolate specific pieces to change, or in some cases, the whole name. For example: Lets say I have three ...
0
votes
1answer
77 views

sed replace misplaces slashes

I have the following code in a LaTeX file: for \emph{service} in \emph{host}.resources: for \emph{file} in \emph{host}.resources: \underline{service}.requires.add(\underline{file}) ...
-3
votes
1answer
67 views

How to replace value in each field until a certain character in each record?

Each record coming with column names. I have to replace them in each record as shown below: TIME=20181219110000275|CHAN=FMBKHJBAAAADPCFNAAAAAABA|EVNT=SWIgrld|API=SWIrecGrammarActivate|TYPE=uri/2.0|...