10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to insert "Text" in each file as a place where I mentioned below "Insert Text Here". These files are something like news of newspaper. Generally, newspaper headlines contain one or two lines.
I don't know how it can be identified whether Text is inserted after first line or second line.
... (10 Replies)
Discussion started by: imranrasheedamu
10 Replies
2. Shell Programming and Scripting
Hi!
Considering below text, how would I use sed to insert text right below the v0005-line, using the SEPARATOR-line as a pattern to search for, so two lines above the separator? I can do it right above the separator, but not 2 lines...
# v0004 - Some text
# v0005 - More text
#... (5 Replies)
Discussion started by: indo1144
5 Replies
3. Shell Programming and Scripting
I want to put a particular text, say, the hash '#' before each of the first n lines of a file.
How can I do that? (4 Replies)
Discussion started by: hbar
4 Replies
4. Shell Programming and Scripting
Hi I was wondering if anyone new of a solution to this problem? I need to copy a time stamp that is on a line of .text in a text file into multiple positions on the same line.
I need to insert the time stamp on the same line between every occurance of the text ".pdf_.html" right after the... (9 Replies)
Discussion started by: Paul Walker
9 Replies
5. Shell Programming and Scripting
Hi
I am trying to insert a block of text 2 lines above a pattern match using sed
eg
#Start of file entry
{
}
#End of file entry
new bit of text has to be put in just above the } eg
#Start of file entry
{
New bit of text
}
#End of file entry (7 Replies)
Discussion started by: eeisken
7 Replies
6. Shell Programming and Scripting
sed 's/$/TEST/g' will insert TEST at the end of each line. i want to insert TEST at column 64 (7 Replies)
Discussion started by: lawsongeek
7 Replies
7. Shell Programming and Scripting
I have done this sed command to insert one line after a specific string is found:
sed '/patternstring/ a\
new line string' file1
But how do I insert two lines? This is not possible:
sed '/patternstring/ a\
new line string \a
new line string 2' file1 (2 Replies)
Discussion started by: locoroco
2 Replies
8. UNIX for Dummies Questions & Answers
I need help on how I can accomplish my task. I hope someone can help me since I've researching and trying to accomplish this for hours now. Basically, I need to comment-out (or insert a # sign in the beginning of the line) a line when the line has the specific word I am searching. Example I have... (3 Replies)
Discussion started by: Orbix
3 Replies
9. Shell Programming and Scripting
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies
10. UNIX for Dummies Questions & Answers
Hello. Trying to insert text at line 1 and after last line of file. I have searched posts but nothing seems to work. I keep getting extra characters error or nothing gets inserted into the file.
#!/bin/sh
touch textfile.txt
sed 'i\
Add this line before every line with WORD' textfile.txt
... (5 Replies)
Discussion started by: steveramsey
5 Replies