|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
[Solved] using sed delete a line from csv file based on specific data in two separate fields
Hello, I have a 12 column csv file. I wish to delete the entire line if column 7 = hello and column 12 = goodbye. I have tried everything that I can find in all of my ref books. I know this does not work Code:
/^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]"hello",[^,]*,[^,]*,[^,]*,[^,]*,[^,]"goodbye"/d Any ideas? Thanks
Last edited by vbe; 10-10-2012 at 11:45 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
sed '/^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,"hello",[^,]*,[^,]*,[^,]*,[^,]*,"goodbye"/d' infile |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Perfect. That worked.
Thanks |
| Sponsored Links | ||
|
![]() |
| Tags |
| column match, csv file, sed delete line |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delete line based on count of specific character | tiggyboo | Shell Programming and Scripting | 5 | 06-25-2012 11:18 AM |
| [Solved] making each word of a line to a separate line | rbalaj16 | Shell Programming and Scripting | 8 | 03-26-2012 05:09 AM |
| Extracting specific lines of data from a file and related lines of data based on a grep value range? | Wynner | Shell Programming and Scripting | 3 | 05-18-2011 11:35 AM |
| Match data based on two fields, and append to a line | jamessmith01 | Shell Programming and Scripting | 20 | 09-06-2010 12:22 PM |
| Delete line in file based on data in another file | earth_goddess | Shell Programming and Scripting | 1 | 12-29-2008 09:47 AM |
|
|