The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copy string from files into new file rdell Shell Programming and Scripting 2 11-20-2008 01:14 AM
folder existing and file existing crowman Shell Programming and Scripting 4 08-28-2008 06:07 PM
How to copy one folder to another with existing files lalelle Shell Programming and Scripting 2 08-21-2008 08:50 AM
substr from a string in Shell script yajaykumar Shell Programming and Scripting 3 08-06-2008 12:51 PM
Copy / string. Paulw0t Shell Programming and Scripting 6 03-10-2007 11:26 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-30-2008
jaivipin jaivipin is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 2
copy substr in existing string in Perl

Any clue to write something to a particular location in Perl?

Suppose

$line = ‘abc cde 1234”

How to write ( example string "test") on location 4 without parsing the whole line.

Output should be $line = ‘abctest 1234”

this is not search and replace. just to add substring into some existing string.

thanks
  #2 (permalink)  
Old 12-31-2008
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 707
Hi.

Welcome to the forum.

Look through perldoc -q string ... cheers, drl
  #3 (permalink)  
Old 12-31-2008
KevinADC KevinADC is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2008
Posts: 731
Hopefully I'm not doing your school work for you:

Code:
$line = 'abc cde 1234';
substr $line,3,4,'test';
print $line;
Look up the substr() function for details
  #4 (permalink)  
Old 12-31-2008
jaivipin jaivipin is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 2
Thanks. I did it aleady
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0