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
change in file requires learnbash Shell Programming and Scripting 10 09-19-2008 04:50 AM
Change word in list - PERL pmpx Shell Programming and Scripting 1 06-30-2008 07:59 PM
Hw to change the font of output in perl trupti_rinku Shell Programming and Scripting 2 11-14-2006 10:59 AM
change function structure with perl (regExp) umen Shell Programming and Scripting 1 08-19-2006 11:20 AM
how to change working directories in perl? megastar Shell Programming and Scripting 1 11-02-2005 03:05 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 09-19-2008
learnbash learnbash is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 96
change requires with perl

Hi,

i need to change a file with perl having contents below, but it will not do any action if change is being already made.

file.txt
AAAAAA
BBBBBB
CCCCCC

output.txt (that required)

AAAAAA
#BBBBB
DDDDDD

CCCCCC


Thanks,
  #2 (permalink)  
Old 09-19-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
sed is easier...
Code:
sed 's/^BBBB/#&/'  file > newfile
  #3 (permalink)  
Old 09-19-2008
learnbash learnbash is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 96
Hi jim,

its so nice you see my post answer, but lets see there are two points, lets suppose i want to comment a particular line number with "#" and wants to add one line text on particular line number, for example i want to comment 45th line and wants to add another line after 90th line and if it is already done so it wont do anything how can i put this.

Thanks, pls advice.
bash
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 03:17 AM.


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