1
vote
2answers
67 views

Long string insertion with sed

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 \ ...
2
votes
5answers
162 views

Why isn't sed working?

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 ...
-1
votes
3answers
358 views

unix command to remove empty lines in a file

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> ...
1
vote
1answer
1k views

use SED recursively in linux?

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 ...
3
votes
2answers
221 views

unix script problem

I have a simple script which runs on a FreeBSD machine with the following code: #!/bin/sh `sed -i .bak '\:#start 172.0.0.3:,\:#end 172.0.0.3:d' /usr/local/etc/racoon/racoon.conf` echo $? It should ...
0
votes
7answers
740 views

vi syntax to comment out non-commented lines (cron)

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 ...