Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-03-2013, 09:22 PM   #1
Registered: Oct 2012
Posts: 56

Rep: Reputation: Disabled
Talking Perl to Remove certain character in every line

I have a file called "one.txt"
And inside the file, there are datas like:
1 -10g 20g -30g
2 10g -30g 50g
3 -10g 40g -70g
I need a Perl script so that the output will be:
1 -10 20 -30
2 10 -30 50
3 -10 40 -70
Note that the 'g' string is removed. Any idea?
Old 01-04-2013, 05:46 AM   #2
Senior Member
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
perl -pe 's/g//g' one.txt


file, perlscript, remove, string

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script/Perl Script to remove the string until it finds special character '_' pooppp Programming 10 07-17-2012 09:36 AM
Shell script/Perl Script to remove the string until it finds special character '_' pooppp Programming 1 07-13-2012 01:03 AM
Remove a new line character kbmukesh Linux - Newbie 3 04-13-2009 12:41 AM
Perl - Tpl file - Need to replace new line character. knnirmal Programming 2 09-07-2004 02:27 PM
PERL:: trying to remove last line of file ocularbob Programming 16 09-01-2003 01:07 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:15 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration