The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Delete first line from file and more.... dfb500 Shell Programming and Scripting 6 07-02-2009 10:04 AM
Delete a line from a file rohini UNIX for Dummies Questions & Answers 8 01-07-2009 06:34 AM
How to delete line from a file ramezernest UNIX for Dummies Questions & Answers 0 11-01-2007 11:56 AM
delete line in file with sed forever_49ers Shell Programming and Scripting 8 09-12-2007 08:39 AM
delete line in a file dta4316 Shell Programming and Scripting 12 05-18-2005 10:20 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-11-2002
elchalateco elchalateco is offline
Registered User
  
 

Join Date: Sep 2002
Posts: 11
Question Delete line(s) from file

What is the easiest way to delete a line from a file?
I have a file that contains list for Domestic and Foreign customers.
I want to delete all lines staring with Foreing.

TIA
  #2 (permalink)  
Old 10-11-2002
biker biker is offline
Registered User
  
 

Join Date: Sep 2002
Location: Austin, TX
Posts: 41
elchalateco,

Try:

grep -v Foreign oldfile > newfile


Biker
Systems/Network Administrator
LiveFire Labs - Hands-On Technical e-Learning
www.LiveFireLabs.com
  #3 (permalink)  
Old 10-11-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Remove blank lines this way.

grep -v ^$ file.in > file.out

The ^ designates the beginning of the line and the $ denotes the end of the line. Together they represent a blank line!


Just in case you were wondering.

  #4 (permalink)  
Old 10-11-2002
elchalateco elchalateco is offline
Registered User
  
 

Join Date: Sep 2002
Posts: 11
Thank you.
  #5 (permalink)  
Old 10-11-2002
biker biker is offline
Registered User
  
 

Join Date: Sep 2002
Location: Austin, TX
Posts: 41
My bag for leaving the "^" off of "Foreign"

Biker
Systems/Network Administrator
LiveFire Labs - Hands-On Technical e-Learning
www.LiveFireLabs.com
Closed Thread

Bookmarks

Tags
sed delete line

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0