![]() |
|
|
grep unix.com with google
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Our Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
deleting when nothing is there
Hey I know how to use grep to eliminate a row when nothing there is a character that I dont want. But I encountered a problem where there is nothing there. Heres my example: Code:
Nam1 Nam2 Year Nam3 Month So for Nam1 there is nothing in the second column so I want to delete it... so anything that has nothing in the second column should be removed. Code:
Nam2 Year Nam3 Month I tried grep but what do i grep for? or is there a faster solution? ![]() thanks |
|
|||
|
assuming you want to eliminate rows that have less than three columns: Code:
awk 'NF>2' inputfile> outputfile change the > 2 part to accomodate your needs. NF means number of columns/fields & > 2 is greater than two. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| deleting a character | phil_heath | Shell Programming and Scripting | 2 | 09-30-2009 09:21 PM |
| Deleting from Mac on GUI? | wmosley2 | OS X (Apple) | 1 | 12-10-2003 11:06 PM |
| Deleting by ID | boyler | Shell Programming and Scripting | 1 | 09-23-2003 11:37 PM |
| Deleting a file I don't own | kumachan | UNIX for Dummies Questions & Answers | 5 | 09-19-2003 11:50 AM |
| usb - deleting (irq) | termiEEE | UNIX for Dummies Questions & Answers | 1 | 04-18-2002 06:56 AM |