Remove Multiple numbers from file.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove Multiple numbers from file.
# 8  
Old 02-26-2010
Bug

Dear Friend msalam65 ,

You can use the following coding for your requirement

Code:
use strict;
use warnings;
my $var;
open(FH,"<fil4")or die "can't open";
while($var=<FH>)
{
  chomp($var);
  $var=~s/[0-9]{2,}//g;
  print "$var\n";
}

# 9  
Old 02-26-2010
Thanks durden_tyler. The perl command worked. Thanks again.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove space before numbers in delimited file

Hi, I have a file which looks like this FORD|1333-1| 10000100010203| 100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 I need the output to look like this FORD|1333-1|10000100010203|100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 The leading... (8 Replies)
Discussion started by: wahi80
8 Replies

2. Shell Programming and Scripting

Remove '.' from file for numbers ending in '.'

Hi, I have numerous files which have data in the following format A|B|123.|Mr.|45.66|33|zz L|16.|33.45|AC.|45. I want to remove decimal point only if it is last character in a number. O/p should be A|B|123|Mr.|45.66|33|zz L|16|33.45|AC.|45 I tried this sed -e 's/.|/|/g' Problem... (6 Replies)
Discussion started by: wahi80
6 Replies

3. Shell Programming and Scripting

Remove multiple lines from a text file

Hi I have a text file named main.txt with 10,000 lines. I have another file with a list of line numbers (around 1000) of the lines to be deleted from main.txt file. I tried with sed but it removes only a range of line numbers. Thanks for any help!! (1 Reply)
Discussion started by: prvnrk
1 Replies

4. Shell Programming and Scripting

How to remove the numbers in a file in perl script?

Thanks (1 Reply)
Discussion started by: Raysf
1 Replies

5. Shell Programming and Scripting

Renaming file that has multiple numbers as filename

Hi I have a file with filename as "partition-setup-and-ipl.vtcmd.76217657132.9721536798" Now i need to move this file as "partition-setup-and-ipl.vtcmd.76217657132.9721536798_org" i tried with # ls | grep -E "partition-setup-and-ipl.vtcmd.+"... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

6. Shell Programming and Scripting

Split a file into multiple files based on line numbers and first column value

Hi All I have one query,say i have a requirement like the below code should be move to diffent files whose maximum lines can be of 10 lines.Say in the below example,it consist of 14 lines. This should be moved logically using the data in the fisrt coloumn to file1 and file 2.The data of first... (2 Replies)
Discussion started by: sarav.shan
2 Replies

7. Shell Programming and Scripting

Remove Numbers from file

I have a file that has some text that looks like this Some Text 1. More text 2. Different text Final Text I would like the remove the lines of text that start with the numbers. Some Text Final Text I have tried to use cat file.txt | grep -Ev 1. >... (9 Replies)
Discussion started by: icculus99
9 Replies

8. Shell Programming and Scripting

Remove multiple lines in the file

Hi, How to remove duplicate lines in the file. a ------ b c 24 23 a ---- c b (4 Replies)
Discussion started by: sandy1028
4 Replies

9. Shell Programming and Scripting

Command to remove numbers from beginning of txt file

Hello. I have the following issue: my txt file has the following format: train/dr4/fklc0/sx175.txt 0 80282 Severe myopia contributed to Ron's inferiority complex. train/dr4/fklc0/sx355.txt 0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt With the... (1 Reply)
Discussion started by: li_bi
1 Replies

10. Shell Programming and Scripting

how to remove files with only numbers as file names?

Hi all, I have a bunch of files that are named like 12543, 467249877, etc all over some directories.These files are named only with numbers, they dont have any letters or special characters in their file names. Could you please help me out and give me some command/script to remove only those... (6 Replies)
Discussion started by: praveen_indramo
6 Replies
Login or Register to Ask a Question