I am trying to use this expression to insert the contents of one text file into another after a give string. This is a simple bash script: TEXT=`cat file1.txt` sed -i "/teststring/a \ ...
I have a file that has a single line with a lot of ! characters. I want to remove all of the ! characters. I tried this: sed s/!// myfile and this: sed 's/!//' myfile and this: sed ...
How do I remove empty/blank (including spaces only) lines in a file in Unix/Linux using the command line ? contents of file.txt Line:Text 1:<blank> 2:AAA 3:<blank> 4:BBB 5:<blank> ...
I want to implement the following command recursively sed -i 's/href=\"1\//href=\"\/1\//g' ./* so that it replaces all href="1 with href="/1 in all sub-directories. Is there a flag I can add to ...
I have a simple script which runs on a FreeBSD machine with the following code: #!/bin/sh `sed -i .bak '\:#start 22.214.171.124:,\:#end 126.96.36.199:d' /usr/local/etc/racoon/racoon.conf` echo $? It should ...
Anyone know if it's possible in vi to replace only uncommented/non-blank lines with comments? If I want to replace a commented line with something I know I can use :%s/^#/##foo##/g -- but I am ...