Sponsored Content
Top Forums Shell Programming and Scripting Remove lines with unique information in indicated columns Post 302890945 by Scrutinizer on Sunday 2nd of March 2014 03:53:23 PM
Old 03-02-2014
Code:
awk '$2 in A{print A[$2] $0; A[$2]=x; next} {A[$2]=$0 ORS}' file


Last edited by Scrutinizer; 03-02-2014 at 05:00 PM..
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove lines with n columns

Hi folks - hope you are all well. I am trying to perform some pre-processing on a data file, to make sure it is in a valid format before performing a data upload. Each row of data in the file should consist of 10 comma delimited fields. Can anyone advise me of a sed/awk command that might... (2 Replies)
Discussion started by: Krispy
2 Replies

2. Shell Programming and Scripting

Remove lines, Sorted with Time based columns using AWK & SORT

Hi having a file as follows MediaErr.log 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:12:16 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:22:47 84 Server1 Policy1 Schedule1 master1 05/08/2008 03:41:26 84 Server1 Policy1 ... (1 Reply)
Discussion started by: karthikn7974
1 Replies

3. Shell Programming and Scripting

Remove All Lines Between Two Unique Lines

Hi all! Im wondering if its possible to remove all lines between two lines. Im working with a document like this: data1 data2 <Remove> data3 data4 </Remove> data5 data6 I need it to end up like this if that possible: data1 data2 data5 data6 There are multiple instances of... (2 Replies)
Discussion started by: Grizzly
2 Replies

4. Shell Programming and Scripting

awk : extracting unique lines based on columns

Hi, snp.txt CHR_A SNP_A BP_A_st BP_A_End CHR_B BP_B SNP_B R2 p-SNP_A p-SNP_B 5 rs1988728 74904317 74904318 5 74960646 rs1427924 0.377333 0.000740085 0.013930081 5 ... (12 Replies)
Discussion started by: genehunter
12 Replies

5. UNIX for Advanced & Expert Users

In a huge file, Delete duplicate lines leaving unique lines

Hi All, I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space. I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
Discussion started by: krishnix
16 Replies

6. UNIX for Dummies Questions & Answers

remove duplicate lines based on two columns and judging from a third one

hello all, I have an input file with four columns like this with a lot of lines and for example, line 1 and line 5 match because the first 4 characters match and the fourth column matches too. I want to keep the line that has the lowest number in the third column. So I discard line 5.... (5 Replies)
Discussion started by: TheTransporter
5 Replies

7. Shell Programming and Scripting

How to merge columns into lines, using unique keys?

I would really appreciate a sulution for this : invoice# client# 5929 231 4358 231 2185 231 6234 231 1166 464 1264 464 3432 464 1720 464 9747 464 1133 791 4930 791 5496 791 6291 791 8681 989 3023 989 (2 Replies)
Discussion started by: hemo21
2 Replies

8. UNIX for Dummies Questions & Answers

Print unique lines without sort or unique

I would like to print unique lines without sort or unique. Unfortunately the server I am working on does not have sort or unique. I have not been able to contact the administrator of the server to ask him to add it for several weeks. (7 Replies)
Discussion started by: cokedude
7 Replies

9. Shell Programming and Scripting

Remove nullable columns in lines

Hi Every one, my requirement is to remove the null columns in line, comma delimiter used For example, A,11,20,30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, B1,,,,,, gem,plum,kite,,,,gud,bad,,,,,,,,,,,,, B2,kiing,kong,height,,,,,,,,,,,,,,,,,,,,,,,,,rak,,,,,,,,,,,,, B1,,,,,,... (9 Replies)
Discussion started by: skpshell
9 Replies

10. Shell Programming and Scripting

Reading multiple values from multiple lines and columns and setting them to unique variables.

Hello, I would like to ask for help with csh script. An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
Discussion started by: FMMOLA
7 Replies
VP(4)							     Kernel Interfaces Manual							     VP(4)

NAME
vp - Versatec printer-plotter DESCRIPTION
Vp0 is the interface to a Versatec D1200A printer-plotter with a Versatec C-PDP11(DMA) controller. Ordinarily bytes written on it are interpreted as ASCII characters and printed. As a printer, it writes 64 lines of 132 characters each on 11 by 8.5 inch paper. Only some of the ASCII control characters are interpreted. NL performs the usual new-line function, i.e. spaces up the paper and resets to the left margin. It is ignored however following a CR which ends a non-empty line. CR is ignored if the current line is empty but is otherwise like NL. FF resets to the left margin and then to the top of the next page. EOT resets to the left margin, advances 8 inches, and then performs a FF. The ioctl(2) system call may be used to change the mode of the device. Only the first word of the 3-word argument structure is used. The bits mean: 0400 Enter simultaneous print/plot mode. 0200 Enter plot mode. 0100 Enter print mode (default on open). 040 Send remote terminate. 020 Send remote form-feed. 010 Send remote EOT. 04 Send remote clear. 02 Send remote reset. On open a reset, clear, and form-feed are performed automatically. Notice that the mode bits are not encoded, so that it is required that exactly one be set. In plot mode each byte is interpreted as 8 bits of which the high-order is plotted to the left; a `1' leaves a visible dot. A full line of dots is produced by 264 bytes; lines are terminated only by count or by a remote terminate function. There are 200 dots per inch both ver- tically and horizontally. When simultaneous print-plot mode is entered exactly one line of characters, terminated by NL, CR, or the remote terminate function, should be written. Then the device enters plot mode and at least 20 lines of plotting bytes should be sent. As the line of characters (which is 20 dots high) is printed, the plotting bytes overlay the characters. Notice that it is impossible to print characters on baselines that differ by fewer than 20 dot-lines. In print mode lines may be terminated either with an appropriate ASCII character or by using the remote terminate function. FILES
/dev/vp0 SEE ALSO
opr(1) VP(4)
All times are GMT -4. The time now is 01:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy