The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to delete empty lines Aejaz UNIX for Advanced & Expert Users 5 04-30-2008 07:27 AM
regex to delete multiple blank lines in a file? fedora Shell Programming and Scripting 6 10-11-2007 01:36 PM
using sed command to delete a string spanning multiple lines radha.kalivar Shell Programming and Scripting 9 07-25-2007 07:26 AM
Need to delete multiple lines in a file. kangdom Shell Programming and Scripting 6 10-16-2006 08:02 AM
Delete multiple lines w/ sed bookoo Shell Programming and Scripting 2 07-25-2003 07:03 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-09-2005
whatisthis's Avatar
Registered User
 

Join Date: Aug 2004
Posts: 175
delete multiple empty lines

Hi,
I need to delete the lines with empty name.

What is the best way to do it?

Thanks a lot for your help!


EMID MMDDYY HOURS JOB EMNAME
0241 051605 11.40 52062 someone
0520 051605 10.63 52062
0520 051605 10.66 52062
0520 051605 10.65 52062
Reply With Quote
Forum Sponsor
  #2  
Old 11-09-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,295
Code:
awk '{ if(NF==5) {print $0 } }' filename > newfilename
Reply With Quote
  #3  
Old 11-09-2005
Registered User
 

Join Date: Jul 2005
Posts: 137
Quote:
Originally Posted by jim mcnamara
Code:
awk '{ if(NF==5) {print $0 } }' filename > newfilename
Code:
awk 'NF==5' filename > newfilename
Reply With Quote
  #4  
Old 11-09-2005
whatisthis's Avatar
Registered User
 

Join Date: Aug 2004
Posts: 175
extra line in the file

Hi,
Thanks for the help.
I used it and also got an extra line at the end of the file:


[+pos1 [-pos2]] [-k field_start[type][,field_end[type]] [file...]


????
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0