7
votes
3answers
437 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
49 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
401 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
696 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
402 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
509 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 ...