Remove Numbers from file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove Numbers from file
# 1  
Old 09-28-2011
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. > file2.txt
However it just removes lines from the file.

Thank you
# 2  
Old 09-28-2011
Try:

Code:
awk ' $1+0 == 0 ' input-file-name >new-file-name

Will remove any line that starts with a number other than zero.

Last edited by agama; 09-28-2011 at 08:31 PM.. Reason: typo
# 3  
Old 09-28-2011
cat some .txt
------
text begin
1. algo
2. otro
3. algo mas
text end

------
sed -i 's/^[0-9].*$//g' some.txt |awk NF -

----
cat some.txt

text begin
text end
----------------
simple and practical
# 4  
Old 09-28-2011
That worked!

Thank you for your help.
# 5  
Old 09-28-2011
That worked great.
Thank you
# 6  
Old 09-28-2011
Try this
Code:
cat <inpput file> | grep ^[a-z,A-Z] >> <ouputfile>


Last edited by Franklin52; 09-29-2011 at 07:39 AM.. Reason: Please use code tags, thank you
# 7  
Old 09-28-2011
Code:
 
$ awk '!/^[0-9]/' inputfile
Some Text 
Final Text

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

Adding (as in arithmetic) to numbers in columns in file, and writing new file with new numbers

Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do. I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies

4. Shell Programming and Scripting

Remove numbers

how to remove all numbers from this.Using sed command 1. abcd123 2. 312jjs33 (17 Replies)
Discussion started by: rafa_fed2
17 Replies

5. Shell Programming and Scripting

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

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

6. 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

7. Shell Programming and Scripting

Remove Multiple numbers from file.

Hi, I am trying to cleanup 7 or 10 digits numeric from the file. So for example : Input : 3M Corporation 3M Inc. 888-356-8765 3M Inc. 356-8765 3M Inc. 3568765 3M Inc. 356-8765 3M 8883568765 Inc. Output : 3M Corporation 3M Inc. - - 3M Inc. - 3M Inc. 3M Inc. - (8 Replies)
Discussion started by: msalam65
8 Replies

8. Shell Programming and Scripting

remove the numbers

How can I remove the numeric (1,2,3,4,5,etc.) in front of each line? The file look like this.. 1CREATE OR REPLACE pROD (p_sc_id number, 2 p_snap_id number , p_sid number, p_halt varchar2 default 'N', p_a_nm varchar2 ) 3 as 4 v_rtn number; 5 6 v_rtn... (3 Replies)
Discussion started by: Beginer0705
3 Replies

9. Shell Programming and Scripting

How to remove numbers from filename

Hi all, Can I edit this script: find . -type f | while read i;do && mv "$i" "${i//abc/}" ;done so that it will not only take out abc from the filename but also take out any numbers that might be in the filename as well. An example would be, Input: filename abc 2009.mov Output:... (7 Replies)
Discussion started by: Monkey Dean
7 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