Linked Questions

4 votes
1 answer
3k views

we have for example this file cat exam.txt I am expert linux man what we can do for out country I love redhat machine "propertie" centos less then redhat fedore what my name is moon yea we want to ...
yael's user avatar
  • 14k
9 votes
3 answers
10k views

I'm trying to take the contents of a file and insert it after a matching pattern in another file using sed. My question is very similar to this question, but I wish to insert the contents of a file ...
turtle's user avatar
  • 2,797
11 votes
4 answers
15k views

I'm attempting to replace a pattern in a file with the complete contents of another file using sed. Currently I am using: sed "s/PATTERN/`cat replacement.txt`/g" "openfile.txt" > "output.txt" ...
Sam's user avatar
  • 255
12 votes
3 answers
4k views

Say I had a block of text in the ~/.bashrc: #~/.bashrc # ...some commands... # aliases alias suicide='sudo rm -rf /' # end aliases # other commands I wish to replace that block of text with some ...
thenaglecode's user avatar
2 votes
3 answers
10k views

I am trying to replace strings found in File1 with strings in File2 File1 <IMG SRC="/Repository/GetImage.dll?baseHref=Orange/2011/03/27&amp;EntityID=Ad12911&amp;imgExtension=" /> <...
rbroadus's user avatar
4 votes
3 answers
2k views

I have a file that begins with a few "include" statements, like this: include foo.xyz include bar.xyz do c do d Suppose the file foo.xyz contains do a and the file bar.xyz contains do b. How can I ...
John Wickerson's user avatar
3 votes
2 answers
1k views

I want to replace a long part of a file with something else preferably by sed but want to read that long part from a file. I already found this: sed -e '/<TEXT1>/{r File1' -e 'd}' File2 from ...
sepehr's user avatar
  • 303
2 votes
1 answer
3k views

I have two files. The fist file is an existing C/C++ source file (*.cpp). The second is a text file (*.txt) and contains one function. The function is in both files, and it needs to be copied from the ...
user avatar
1 vote
3 answers
147 views

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); ...
alancc's user avatar
  • 213
0 votes
2 answers
141 views

Let's say I have a program blackbox, and a file with the following contents: in this file this line contains =TAG= so does =TAG= this one as =TAG= does this other line this line does ...
wobtax's user avatar
  • 1,195