remove lines in text starting with . (period)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers remove lines in text starting with . (period)
# 1  
Old 04-23-2008
remove lines in text starting with . (period)

how can i remove lines from a text file starting with . (a period)
# 2  
Old 04-23-2008
try:
grep -v ^. yourfile > newfile

i'm on win right now and can't test it Smilie
# 3  
Old 04-23-2008
that doesn't seem to work. All i get is a blank file thanks though, if you have other suggestions i can test them pretty quickly
# 4  
Old 04-23-2008
grep -v "^." yourfile > newfile

' or " you have to try a little
# 5  
Old 04-23-2008
Hmmm....

I would have said:

grep -v "\." yourfile > newfile


Using a caret didn't work for me.

FYI: I'm using ksh
# 6  
Old 04-23-2008
Quote:
Originally Posted by Dave Miller
Hmmm....

I would have said:

grep -v "\." yourfile > newfile


Using a caret didn't work for me.

FYI: I'm using ksh
but this takes all lines with a . in it and not only on the beginning off a line?
# 7  
Old 04-23-2008
Code:
grep "^\." file

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need to remove lines starting with an ID from all fine in a director

Hi All, I have almost 200 files in a directory I want to remove all lines in each file that is starting with 88002 and 88003. I tried with grep -v and if I plan to do that I need to for all the files individually and it is 200+ files. Any way I can do at single command ... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

2. Shell Programming and Scripting

Using awk to remove lines from file that match text

I am trying to remove each line in which $2 is FP or RFP. I believe the below will remove one instance but not both. Thank you :). file 12 123 FP 11 10 RFP awk awk -F'\t' ' $2 != "FP"' file desired output 12 11 (6 Replies)
Discussion started by: cmccabe
6 Replies

3. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies

4. Windows & DOS: Issues & Discussions

Remove duplicate lines from text files.

So, I have text files, one "fail.txt" And one "color.txt" I now want to use a command line (DOS) to remove ANY line that is PRESENT IN BOTH from each text file. Afterwards there shall be no duplicate lines. (1 Reply)
Discussion started by: pasc
1 Replies

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

6. Shell Programming and Scripting

Remove all lines except lines starting with [

Hello, I am trying to remove all the lines in file except lines starting with [ How can i accomplish this? Thank you very much in advance. (4 Replies)
Discussion started by: maxo
4 Replies

7. Shell Programming and Scripting

remove lines starting with

Hi I have an input file... /* ----------------- AGYDLY_Box ----------------- */ insert_job: AGYDLY_Box job_type: b owner: spdrdev permission: gx,wx date_conditions: 1 days_of_week: mo,tu,we,th,fr exclude_calendar: mtg_holidays start_times: "1:00" description: "Process Daily New pools... (2 Replies)
Discussion started by: ramky79
2 Replies

8. Shell Programming and Scripting

Searching the lines within a range of time period in a text file

Dear All, Please advice me, I have a text file with one field date and time like below given. I need to find out the lines whchi content the time stamp between Wed May 26 11:03:11 2010 and Wed May 26 11:03:52 2010 both can be included, using awk command which could be an interactive so that I... (6 Replies)
Discussion started by: chinmayadalai
6 Replies

9. Shell Programming and Scripting

sed help - remove a period from a domain name

I have this code that parses the output of a reverse dns lookup to a domain name nslookup $IP | sed -n 's/.*arpa.*name = \(.*\)/\1/p' But my ouput is always randomsite.com. Notice the period tacked on to the end. How do I correct this so it is just randomsite.com Thank you. (1 Reply)
Discussion started by: streetfighter2
1 Replies

10. Shell Programming and Scripting

shell script to remove all lines from a file before a line starting with pattern

hi,, i hav a file with many lines.i need to remove all lines before a line begginning with a specific pattern from the file because these lines are not required. Can u help me out with either a perl script or shell script example:- if file initially contains lines: a b c d .1.2 d e f... (2 Replies)
Discussion started by: raksha.s
2 Replies
Login or Register to Ask a Question