10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyone,
I am trying to insert a single very long string as the first line of a file,
So the following sed commands does what I want;
sed '1i\"","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"' file.txt
Think that all the... (3 Replies)
Discussion started by: hayreter
3 Replies
2. Shell Programming and Scripting
I need to insert text from one file into another file after specific term. I guess sed is the best method of doing this and I can insert a specified text string using this script but I am not sure how to modify it to insert text from another file:
#!/bin/sh
sed 's/\<VirtualHost... (17 Replies)
Discussion started by: barrydocks
17 Replies
3. Shell Programming and Scripting
Could anyone tell me how to insert a line at a particular line number using sed.
sed '2i\newtext' filename
I have tried the above command .But it is not working. I am using tcsh shell .Please help.
Double post, continued here (0 Replies)
Discussion started by: maitree
0 Replies
4. Shell Programming and Scripting
Hi guys,
I need to insert @test.com after each entry in my .txt file.
1
2
3
4
1@test.com
2@test.com
3@test.com
4@test.com
Tried to use
cat test.txt |sed 's/$/@test.com/'but it does this instead:
1
@test.com
2 (6 Replies)
Discussion started by: spirm8
6 Replies
5. Shell Programming and Scripting
Hello,
i use sed '/good/ a\INSERT' 1.txt command for insert a text on my file on linux butit does not work see the output :
# sed '/good/ a\INSERT' 1.txt
if_test=iso
ifup=eth0
Hello
World
Bye
now
good
INSERT
# cat 1.txt
if_test=iso
ifup=eth0
Hello
World
Bye
now (1 Reply)
Discussion started by: blackmetal
1 Replies
6. Shell Programming and Scripting
#!/bin/bash
wget -O tmp.tmp "YouTube - Pretty Woman- Vivian's Goes Shopping!"
temp=`grep 'one&video_id=' tmp.tmp | sed "s/.*one&video_id=\(.*\)'\;.*/\1/"`
temp="http://www.youtube.com/get_video?video_id=$temp"
temp=`echo $temp|sed -n "s/!/\\!/p"`
echo " -O $filename \"$temp\""
Output:... (3 Replies)
Discussion started by: kds1398
3 Replies
7. Shell Programming and Scripting
Dear All,
I have a file called football where i have a list of 11 players each on different lines.
I wish to add a name of another player on the first line.
I have created a file called footballscript in vi writing the following sed command to achieve this ...
cat football | sed -e '1 i\... (4 Replies)
Discussion started by: Mary_xxx
4 Replies
8. Shell Programming and Scripting
Hello all and thanks in advance!
What I'm looking to do is insert a blank line, anytime the first 9 characters of a given line don't match the first 9 characters of the previous line.
i.e.
Convert the data set
1 45 64 89
1 89 69 235
2 89 234 67
2 56 90... (1 Reply)
Discussion started by: selkirk
1 Replies
9. Shell Programming and Scripting
Hi,
I have tried to develop a sed script that inserts date and time in the third field in the first and second row below. The third row is an example and it shows where the date and time should be inserted. The script should check if the row already has date and time in the third field and if it... (2 Replies)
Discussion started by: pcrs
2 Replies
10. Shell Programming and Scripting
I suppose this is a silly newbie Q, but I have a set of text I am inserting into a file using a sed cmd and before I insert, I want to ask the sed operation to move to add a carriage return first, and then place my new line.
Is there scope within the sed command to do this - i have tried "\n"... (6 Replies)
Discussion started by: sirtrancealot
6 Replies