Questions tagged [replace]
The replace tag has no summary.
449 questions
3votes
5answers
645views
removing braces statements containing nested braces inside
A typical latex problem: \SomeStyle{\otherstyle{this is the \textit{nested part} some more text...}} Now I want to remove all \SomeStyle{...} but not the content. Content contains nested braces. The ...
1vote
3answers
125views
sed to replace in a file, with both old and new strings in files
I want to automatically comment out a code block in PHP file, as below: The original block: // Enable all errors ini_set('display_startup_errors', 1); ini_set('display_errors', 1); ...
6votes
3answers
469views
zmv: Replace double-quote (") in filename
Using zmv on macOS, I'd like to replace double-quotes (") in filenames with underscores (_). However, I'm having trouble getting the zshexpn to correctly isolate the ". Is there some magical ...
0votes
0answers
147views
Find and replace in CudaText editor
So I have dump from U-boot and I need to replace specific string in CudaText editor. Here is mine text e101b1e0: 30ef27d8 e792f415 9beea618 5c601de4 .'.0..........`\ e101b1f0: aeaf9d25 e1dd63e9 ...
1vote
1answer
48views
Search and replace content
PIN A 1 1:3 0:8 0 0:0 PIN B 1 1:0 0 0:0 Z Z:0 PIN C 1 1:3 0:8 0 0:0 Z Z:0 I would like to change the content on PIN A & PIN C only without affecting PIN B to 0 0:3 Z 0:3 Can't seem to find a ...
0votes
1answer
100views
How to do replace with the dte editor
The dte editor a small and easy to use console text editor. In readme or its online doc, both says: Regex search and replace (are the key features). However, I haven't found how to do the replace ...
2votes
1answer
182views
Replacing a character in all files names of a directory
This is homework! I'm trying to replace all spaces in file names with an underscore in the yay directory. It asks me to use the commands xargs and sh without using $(command). I tried using conducts ...
1vote
2answers
52views
replace both filename and filename's content relying solely on pattern found on the name-of-the-file
I'd like to know if it's possible to replace both filename.ext and a matched pattern inside its content regarding a pattern founded on the filename itself using sed (and grep also, maybe?). Let me ...
-3votes
2answers
97views
How can find special row and replace special strings
I wrote a todo list script with "add","clear" and "find" argument. I need to pass a "done" argument and script find related row and replace its first column ...
0votes
4answers
801views
sed: Replacing successful as the condition
I bumped into an excellent use of sed to do replacing, and use its successful state as the condition to print the line: $ seq 3 | sed -n 's/2/B/ p' B I'm wondering if this short form can be extended ...
0votes
3answers
612views
Adding 10 whitespace characters using sed
I have written a script that replaces a string, but I need to add the 10 whitespace characters back. I can add it back by pressing space 10 times, and that works, but this looks hideous in my script. ...
1vote
4answers
366views
Insert one file's content into another file and replace it between pattern
I have a file1.html: <!doctype html> <html> <head> </head> <body> text <!-- start-replacing --> <p>more text1</p> <p>more text2</p> ...
0votes
1answer
230views
Replacing multiple substrings in a filename with one (bash or zsh)
I have a text file with filenames, where the filenames contain information in various formats (e.g., resolution 4k, 4K, 2160, XxY etc) and I want to rename files to a singular consistent format. When ...
1vote
1answer
329views
Find and replace a special pattern for all files in a folder
I have a series of files in a common bioinformatic format (FASTA) that consist of a string of: 1 special character ">", text as the sample name (length of the string varies, can include ...
3votes
5answers
415views
Replace empty lines in one file with lines from another file
I have file1.csv "word 1" "" "word 3" "" "word 5" "word 6" and file2.csv "replacement text 1" "replacement text 2" &...