Sponsored Content
Full Discussion: Delete rows with conditions
Top Forums Shell Programming and Scripting Delete rows with conditions Post 302927523 by hayreter on Wednesday 3rd of December 2014 03:59:42 PM
Old 12-03-2014
Delete rows with conditions

Hi everyone,

I will appreciate a lot if anyone can help me about a simple issue.
I have a data file, and I need to remove some rows with a given condition.
So here is a part of my data file:

Code:
5,14,1,3,3,0,0,-0.29977188269E+01
5,16,1,4,4,0,0,0.30394279900E+02
5,13,1,4,4,0,0,0.15108184243E+02
5,-14,1,4,4,0,0,0.38275921713E+01
6,-2,-1,0,0,0,501,0.00000000000E+00
6,2,-1,0,0,501,0,0.00000000000E+00
6,-15,2,1,2,0,0,0.43485959710E+02
6,15,2,1,2,0,0,-0.43485959710E+02
7,4,-1,0,0,501,0,0.00000000000E+00
7,-4,-1,0,0,0,501,0.00000000000E+00
7,23,2,1,2,0,0,0.14210854715E-13
7,-15,2,3,3,0,0,0.57831183575E+02

The first column is the data set ID, I need to remove data sets in which any of its rows contains 23 in the second column. According to given data above, after the operation it should look like:

Code:
5,14,1,3,3,0,0,-0.29977188269E+01
5,16,1,4,4,0,0,0.30394279900E+02
5,13,1,4,4,0,0,0.15108184243E+02
5,-14,1,4,4,0,0,0.38275921713E+01
6,-2,-1,0,0,0,501,0.00000000000E+00
6,2,-1,0,0,501,0,0.00000000000E+00
6,-15,2,1,2,0,0,0.43485959710E+02
6,15,2,1,2,0,0,-0.43485959710E+02

the number 23 in the second column appears only in data set 7, so the entire data set must be removed from the file.

thanks in advance for any help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to delete particular rows from a file

Hi I have a file having 1000 rows. Now I would like to remove 10 rows from it. Plz give me the script. Eg: input file like 4 1 4500.0 1 5 1 1.0 30 6 1 1.0 4500 7 1 4.0 730 7 2 500000.0 730 8 1 785460.0 45 8 7 94255.0 30 9 1 31800.0 30 9 4 36000.0 30 10 1 15000.0 30... (5 Replies)
Discussion started by: suresh3566
5 Replies

2. Shell Programming and Scripting

delete rows in a file based on the rows of another file

I need to delete rows based on the number of lines in a different file, I have a piece of code with me working but when I merge with my C application, it doesnt work. sed '1,'\"`wc -l < /tmp/fileyyyy`\"'d' /tmp/fileA > /tmp/filexxxx Can anyone give me an alternate solution for the above (2 Replies)
Discussion started by: Muthuraj K
2 Replies

3. Shell Programming and Scripting

delete line with conditions

Hi Dude, I am struck up with another problem,Pls help me I am new to perl , I have little knowledge only. The scenario is ssenthil = rw anilkg = rw @group1 = rw anilkg = rw ssenthil = rw i need output as below , I want to find "anilkg" and delete the preceding... (12 Replies)
Discussion started by: anil8103
12 Replies

4. Shell Programming and Scripting

Delete duplicate rows

Hi, This is a followup to my earlier post him mno klm 20 76 . + . klm_mango unix_00000001; alp fdc klm 123 456 . + . klm_mango unix_0000103; her tkr klm 415 439 . + . klm_mango unix_00001043; abc tvr klm 20 76 . + . klm_mango unix_00000001; abc def klm 83 84 . + . klm_mango... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

5. Shell Programming and Scripting

delete the same rows

each individual (row) has genotype expressed for each SNP (column) file1.txt 1 1 A G A T G T A A A A A A A A A A A A A A A A A A A A A 2 2 G A A A A A A A A A A A A A A A A A A A A A A A A A A 3 3 A A A A A A A A A A A A A A A A A A A A A A A A A A A 4 4 G A G T A T A A A A A A A A A A A... (3 Replies)
Discussion started by: johnkim0806
3 Replies

6. Shell Programming and Scripting

How to copy or cut specific rows from appended file with some conditions

Hi I have one file which is containing about 5000 rows and 20 columns I will just explain about my requirement here briefly with sample file, I have attached also, please help....me.. 1 28.25 36.42 5 28.26 36.42 10 28.23 36.43 15 28.22 36.43 20 28.2 36.42 25... (6 Replies)
Discussion started by: nex_asp
6 Replies

7. UNIX for Dummies Questions & Answers

How to delete rows?

I have an Output file which has the result YYYY 95,77 YYYY YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY YYYY YYYY YYYY I would like to display the above along with a single line with above info. Final output should be YYYY 95 (3 Replies)
Discussion started by: priyanka.premra
3 Replies

8. Shell Programming and Scripting

Help - delete content inside square brackets under conditions

I have the file sed1.txt and I need to strip the brackets (]) and content inside them only when I have two or three letters followed by a colon. for example,it may be any letter, not just abc ] ] #-- cat sed1.txt 1 ] FISICA 2 ]PORTUGUES 3 ] ]MATEMATICA 4 ]]INGLES ] 5 ]QUIMICA 6... (2 Replies)
Discussion started by: dperboni
2 Replies

9. Shell Programming and Scripting

Using sed to delete one regular pattern with conditions

Hi All , I am having a file like this INPUT FILE ############################### addfd_mjlala kksks sksks ks annsns_bbox_2 (sksksk ksks ) adnndn_nsns_bbox_3 (( jsjsdj sjsj ) malm_dkdm lsls lsl mdndk_mkmd_dkd_bbox_4_kdkd ksksk skksk_bbox_jsj_KSK ((jsjsj jsjsj )... (2 Replies)
Discussion started by: kshitij
2 Replies

10. Shell Programming and Scripting

Extract duplicate rows with conditions

Gents Can you help please. Input file 5490921425 1 7 1310342 54909214251 5490921425 2 1 1 54909214252 5491120937 1 1 3 54911209371 5491120937 3 1 1 54911209373 5491320785 1 ... (4 Replies)
Discussion started by: jiam912
4 Replies
CAS(4)							   BSD Kernel Interfaces Manual 						    CAS(4)

NAME
cas -- Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn Gigabit Ethernet driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device miibus device cas Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): if_cas="YES" DESCRIPTION
The cas driver provides support for the Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn Gigabit Ethernet controllers found on- board in Sun UltraSPARC machines and as add-on cards. All controllers supported by the cas driver have TCP/UDP checksum offload capability for both receive and transmit, support for the reception and transmission of extended frames for vlan(4) and an interrupt coalescing/moderation mechanism as well as a 512-bit multicast hash filter. The cas driver also supports Jumbo Frames (up to 9022 bytes), which can be configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the ifconfig(8) utility configures the adapter to receive and transmit Jumbo Frames. HARDWARE
The chips supported by the cas driver are: o National Semiconductor DP83065 Saturn Gigabit Ethernet o Sun Cassini Gigabit Ethernet o Sun Cassini+ Gigabit Ethernet The following add-on cards are known to work with the cas driver at this time: o Sun GigaSwift Ethernet 1.0 MMF (Cassini Kuheen) (part no. 501-5524) o Sun GigaSwift Ethernet 1.0 UTP (Cassini) (part no. 501-5902) o Sun GigaSwift Ethernet UTP (GCS) (part no. 501-6719) o Sun Quad GigaSwift Ethernet UTP (QGE) (part no. 501-6522) NOTES
On sparc64 the cas driver respects the local-mac-address? system configuration variable which can be set in the Open Firmware boot monitor using the setenv command or by eeprom(8). If set to ``false'' (the default), the cas driver will use the system's default MAC address for all of its devices. If set to ``true'', the unique MAC address of each interface is used if present rather than the system's default MAC address. Supported interfaces having their own MAC address include on-board versions on boards equipped with more than one Ethernet interface and all add-on cards. SEE ALSO
altq(4), miibus(4), netintro(4), vlan(4), eeprom(8), ifconfig(8) HISTORY
The cas device driver appeared in FreeBSD 8.0 and FreeBSD 7.3. It is named after the cas driver which first appeared in OpenBSD 4.1 and sup- ports the same set of controllers but is otherwise unrelated. AUTHORS
The cas driver was written by Marius Strobl <marius@FreeBSD.org> based on the gem(4) driver. BSD
May 3, 2010 BSD
All times are GMT -4. The time now is 02:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy