Sponsored Content
Full Discussion: Perl - Inserting text
Top Forums Shell Programming and Scripting Perl - Inserting text Post 302336609 by NDxiak on Wednesday 22nd of July 2009 12:27:09 PM
Old 07-22-2009
Perl - Inserting text

Hey,

I have 10 lines of text ... And I would like to Insert prefix for each line with static text.

Code:
perl -pi -e 's/()/$1 TEST$./' data.txt

Each line will have different static prefix, Code above works perfectly for 1st line ... I'm just not sure how I can run same command for 2nd line 3rd etc ....
Thank You in Advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl/mail - inserting file text in message body

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

2. Shell Programming and Scripting

Inserting into first record using perl

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

3. UNIX for Dummies Questions & Answers

inserting a text after a certain word in text files

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

4. Shell Programming and Scripting

Need Help in Inserting a new line in a file using PERL

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

5. Shell Programming and Scripting

inserting a string to a text file

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

6. Shell Programming and Scripting

Inserting text with SED

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

7. UNIX for Dummies Questions & Answers

Inserting a column into a text file

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

8. Shell Programming and Scripting

Inserting text into a new file

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

9. Shell Programming and Scripting

Inserting some text if a field in the last column changes

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

10. Shell Programming and Scripting

Help with sed and inserting text from another file

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
Graphics::Primitive::Insets(3pm)			User Contributed Perl Documentation			  Graphics::Primitive::Insets(3pm)

NAME
Graphics::Primitive::Insets - Space between things DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds something. This object can be used to represent either padding or margins (in the CSS sense, one being inside the bounding box, the other being outside) SYNOPSIS
use Graphics::Primitive::Insets; my $insets = Graphics::Primitive::Insets->new({ top => 5, bottom => 5, left => 5, right => 5 }); METHODS
Constructor new Creates a new Graphics::Primitive::Insets. Instance Methods as_array Return these insets as an array in the form of top, right, bottom and left. bottom Set/Get the inset from the bottom. equal_to Determine if these Insets are equal to another. left Set/Get the inset from the left. right Set/Get the inset from the right. top Set/Get the inset from the top. zero Sets all the insets (top, left, bottom, right) to 0. AUTHOR
Cory Watson, "<gphat@cpan.org>" SEE ALSO
perl(1) COPYRIGHT &; LICENSE Copyright 2008-2010 by Cory G Watson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2010-08-21 Graphics::Primitive::Insets(3pm)
All times are GMT -4. The time now is 12:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy