![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Conditionally joining lines in vi | ifermon | UNIX for Dummies Questions & Answers | 0 | 06-04-2008 10:43 AM |
| Email from script conditionally | dfb500 | Shell Programming and Scripting | 2 | 05-01-2007 02:01 PM |
| How can remove -ksh.log | HAA | Shell Programming and Scripting | 0 | 07-17-2006 04:59 AM |
| How to update the contents in a file conditionally? | rajus19 | Shell Programming and Scripting | 5 | 10-14-2005 04:20 AM |
| smitty, remove user, remove directory as well.. | yls177 | UNIX for Dummies Questions & Answers | 2 | 11-11-2002 02:43 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
sed csv remove conditionally
Hello,
I have many csv file, but I would like to delete lines with some values in a column conditionally. My example look like this, ex1e, ex2g, ex39, pasg, ssg, mrlc, pc, kb, coop -112, -53, -177, 64, 62, 71, 1, 487, 20 -101, -61, -53, 0, 32767, 51, 0, 239, 30 -57, -95, -215, 144, 174, 42, 0, 316, 12 23, 47, 32, 42, -300, 71, 0, 112, -23 11, 45, 44, -20, 300, 51, 1, 279, 32 31, 52, 63, 74, 301, 40, 1, 28, -2 82, 35, 23, 77, -299, 51, 1, 0, -1 What I want to do is to look at the field, ssg (column5), then find values only greater than or equal to -300 and less than or equal to 300. So, the result should be look like this. ex1e, ex2g, ex39, pasg, ssg, mrlc, pc, kb, coop -112, -53, -177, 64, 62, 71, 1, 487, 20 -57, -95, -215, 144, 174, 42, 0, 316, 12 23, 47, 32, 42, -300, 71, 0, 112, -23 11, 45, 44, -20, 300, 51, 1, 279, 32 82, 35, 23, 77, -299, 51, 1, 0, -1 I tried to use sed below, but I got stuck after that. sed '/^\([^,]*,\)\{6\}300,...... Please help me. Jae |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|