4
votes
2answers
66 views

Replace very long string in files recursively

I have a very long and complex string in many files and I want to remove/replace it recursively. The string contains many slashes, backslashes and spaces and any kind of special signs. How do I do ...
3
votes
3answers
159 views

Replace multiple strings in a single pass

I'm looking for a way to replace placeholder strings in a template file with concrete values, with common Unix tools (bash, sed, awk, maybe perl). It is important that the replacement is done in a ...
7
votes
3answers
719 views

How to remove a specific character in a string but only if there are no numbers in that line in Linux

I've been stumped with this seemingly simple-to-fix problem.. well, for a while. Here's example output from the file I need to edit: $cat file George Washington Geneva Convention 123,281,029 USD ...
1
vote
0answers
64 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 ...
2
votes
2answers
504 views

remove only specific text occurrences from string using sed

I have a text file that contains many rows of this sort of thing: /*[17:51:27][1 ms]*/ UPDATE `country` SET `region_id` = '4' WHERE `country_id` = '36'; Is there a way that I can use sed to remove ...
4
votes
4answers
835 views

Replace whole line in a file from command-line

I have a text file which has some contents similar to this: # General information about the project. project = u'Py6S' copyright = u'2012, Robin Wilson' # The version info for the project you're ...
2
votes
1answer
450 views

Replace complex string in several files

A hacker got into a web server and added this string (removed some characters for security purposes and added line breaks for readability) in all index.php files: <?php ...
2
votes
3answers
644 views

Collapse repeating characters

Is there a more Bashist way than echo "$PWD//" | sed -e 's#//\+#/#g' to replace repeating slashes with a single one? Thanks Steven D, now there's a fully working function to find the longest common ...