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
SC(4)							   BSD Kernel Interfaces Manual 						     SC(4)

NAME
sc -- Sun Sun-2 SCSI bus host adaptor driver SYNOPSIS
sun2 sc0 at mbmem0 addr 0x80000 ipl 2 sc1 at mbmem0 addr 0x84000 ipl 2 sun2 and sun4 sc0 at vme0 addr 0x200000 irq 2 vec 0x40 DESCRIPTION
The sc driver provides support for the Sun Microsystems "Sun-2" SCSI Bus Controller chipset found on various VME boards (Sun part #s 501-1045, 501-1138, 501-1149, and 501-1167) and on the "Sun-2 SCSI/Serial" (Sun part # 501-1006) Multibus board. All versions of this driver can be configured with a flags directive in the config(1) file. The values are bits in a bitfield, and are interpreted as follows: 0x0ff Set bit (1<<target) to disable SCSI parity checking 0x100 Set this bit to disable DMA interrupts (poll) 0x200 Set this bit to disable DMA entirely (use PIO) For example: "flags 0x1ff" would disable DMA interrupts, and disable parity checking for targets 0-7. The "target" is the SCSI ID number of a particular device on a particular SCSI bus. SEE ALSO
cd(4), ch(4), intro(4), scsi(4), sd(4), st(4) AUTHORS
Matt Fredette <fredette@NetBSD.org>, David Jones, Gordon Ross <gwr@NetBSD.org>, Adam Glass <glass@NetBSD.org>, Jason R. Thorpe <thorpej@NetBSD.org>. BUGS
This SCSI chipset is rumored to have bugs in its handling of SCSI parity, therefore it is recommended that you disable parity on all SCSI devices connected to this controller, and configure it with a 0x0ff value for its flags directive in the config(1) file. This chipset has no support for raising the ATN signal, so there is no way to ever schedule a MSG_OUT phase on the bus. Currently, the driver will ultimately reset the bus if this phase is ever requested by the upper layer SCSI driver. This chipset has no support for SCSI disconnect/reselect. This means that slow devices, such as tape drives, can hog, or "lock up" the SCSI bus. This driver has not been tested in combination with non-SCSI devices behind Emulex or Adaptec bridges, which are common in Sun 2s and in Sun Shoebox-type configurations. These devices pre-date the SCSI-I spec, and might not behave the way the chipset code currently expects. BSD
June 28, 2001 BSD
All times are GMT -4. The time now is 12:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy