10 More Discussions You Might Find Interesting
1. 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
2. Shell Programming and Scripting
Hi,
I have a file which looks like this:
A 01 00
B 02 00
C 04 00
D 00 01
E 01 01
F 02 01
G 01 04
H 02 04
I want to insert some text if the field if the last column changes. It should look like this:
Value 00
A 01 00
B 02 00
C 04 00
Value 01 (6 Replies)
Discussion started by: wenclu
6 Replies
3. Shell Programming and Scripting
Hi all,
I want to create a file and then insert some text into it. I'm trying to create a .sh script that will create a new python file from a template.
Can someone tell me why this won't work,
touch $1 | sed -e '1i\Some test code here'
Sorry I'm quite new to all this!
Just as a side... (3 Replies)
Discussion started by: ahodgson
3 Replies
4. UNIX for Dummies Questions & Answers
I have a tab delimited text file with multiple columns (data.txt). I would like to insert a column into the text file. The column I want to insert is in a text file (column.txt). I want to insert it into the 5th column of data.txt. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies
5. 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
6. Shell Programming and Scripting
Hello
Can somebody please help me with the following script?
I'm trying to create a text file with 20 blank lines and then insert a string in line 2 but nothing is printed in the itxtfile. I can create the file with 20 blank lines but when I "tell" it to print something on the second line, it... (4 Replies)
Discussion started by: goude
4 Replies
7. Shell Programming and Scripting
I need a perl script to find and replace a specific pattern in a file to a new line.
BAsically I have a single line data in a file with 10 mb to 200 MB. I want to put a new line based on a specific pattern to open the file in Excel / Access.
Following is the sample data in a file
... (1 Reply)
Discussion started by: portalfaq
1 Replies
8. UNIX for Dummies Questions & Answers
I need insert a text file content in other text file after certain word like insert content of tagfav.txt in all my html files after the <head> tag. Anyone can help me? (2 Replies)
Discussion started by: ItaloAG
2 Replies
9. Shell Programming and Scripting
hi all... i got some requirment where i need to insert some values into first record of flat file. i am using perl for that job.
var1=456
var2=789
echo `perl -p -i -e "s/U/\${var1}U${var2}/g;" myFile.txt`
but it is writing into all records which has U.... can anyone help me out in this... (7 Replies)
Discussion started by: shreekrishnagd
7 Replies
10. Shell Programming and Scripting
I've got the following code
sub mail_report {
$Mailer = '/usr/sbin/sendmail joe@somewhere.net';
open MAIL,"|$Mailer";
print MAIL "Subject: $X connection attempt \n";
open MESSAGE, "<$outdir$X";
print MESSAGE '$outdir$X\n';
close MESSAGE;
close MAIL;
} #End... (2 Replies)
Discussion started by: thumper
2 Replies