LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Perl to Remove certain character in every line (https://www.linuxquestions.org/questions/programming-9/perl-to-remove-certain-character-in-every-line-4175444065/)

eminempark 01-03-2013 09:22 PM

Perl to Remove certain character in every line
 
I have a file called "one.txt"
And inside the file, there are datas like:
Code:

1 -10g 20g -30g
2 10g -30g 50g
3 -10g 40g -70g

I need a Perl script so that the output will be:
Code:

1 -10 20 -30
2 10 -30 50
3 -10 40 -70

Note that the 'g' string is removed. Any idea?

Snark1994 01-04-2013 05:46 AM

Code:

perl -pe 's/g//g' one.txt


All times are GMT -5. The time now is 04:29 PM.