Sponsored Content
Top Forums Shell Programming and Scripting Print lines in which value in specified Col is NOT unique Post 302886028 by Akshay Hegde on Wednesday 29th of January 2014 11:58:49 AM
Old 01-29-2014
Code:
$ awk 'FNR==NR{A[$2]++;next}A[$2]>1' file file
cat big 24
cat red 63
dog big 34
fish    red 294

edit *I just see yoda's approach and mine are same
This User Gave Thanks to Akshay Hegde For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk to print distinct col values

Hi Guys... I am newbie to awk and would like a solution to probably one of the simple practical questions. I have a test file that goes as: 1,2,3,4,5,6 7,2,3,8,7,6 9,3,5,6,7,3 8,3,1,1,1,1 4,4,2,2,2,2 I would like to know how AWK can get me the distinct values say for eg: on col2... (22 Replies)
Discussion started by: anduzzi
22 Replies

2. Shell Programming and Scripting

Compare Tab Separated Field with AWK to all and print lines of unique fields.

Hi. I have a tab separated file that has a couple nearly identical lines. When doing: sort file | uniq > file.new It passes through the nearly identical lines because, well, they still are unique. a) I want to look only at field x for uniqueness and if the content in field x is the... (1 Reply)
Discussion started by: rocket_dog
1 Replies

3. UNIX for Advanced & Expert Users

Print line based on highest value of col (B) and repetion of values in col (A)

Hello everyone, I am writing a script to process data from the ATP world tour. I have a file which contains: t=540 y=2011 r=1 p=N409 t=540 y=2011 r=2 p=N409 t=540 y=2011 r=3 p=N409 t=540 y=2011 r=4 p=N409 t=520 y=2011 r=1 p=N409 t=520 y=2011 r=2 p=N409 t=520 y=2011 r=3 p=N409 The... (4 Replies)
Discussion started by: imahmoud
4 Replies

4. Shell Programming and Scripting

Compare multiple files and print unique lines

Hi friends, I have multiple files. For now, let's say I have two of the following style cat 1.txt cat 2.txt output.txt Please note that my files are not sorted and in the output file I need another extra column that says the file from which it is coming. I have more than 100... (19 Replies)
Discussion started by: jacobs.smith
19 Replies

5. Shell Programming and Scripting

Modifying col values based on another col

Hi, Please help with this. I have several excel files (with and .xlsx format) with 10-15 columns each. They all have the same type of data but the columns are not ordered in the same way. Here is a 3 column example. What I want to do add the alphabet from column 2 to column 3, provided... (9 Replies)
Discussion started by: newbie83
9 Replies

6. 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

7. Shell Programming and Scripting

Print lines that contain a value in a specific column shared by more than 1 entity in another col

I want to expand on a question that I just asked here: I want to extract only those values in Column 2 that are shared by at least 2 unique values in Column 2. Using the same input (in this case 3- tab-separated columns): waterline-n below-sheath-v 14.8097 dock-n below-sheath-v ... (2 Replies)
Discussion started by: owwow14
2 Replies

8. Emergency UNIX and Linux Support

Read values in each col starting 3rd row.Print occurrence value.

Hello Friends, Hope all are doing fine. Here is a tricky issue. my input file is like this 07 10 14 20 21 03 15 27 30 32 01 10 11 19 30 02 06 14 15 17 01 06 20 25 29 Logic: 1. Please print another column as "0-0-0-0-0" for the first and second rows. 2. Read the first column... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

9. UNIX for Beginners Questions & Answers

Print lines based upon unique values in Nth field

For some reason I am having difficulty performing what should be a fairly easy task. I would like to print lines of a file that have a unique value in the first field. For example, I have a large data-set with the following excerpt: PS003,001 MZMWR/ L-DWD// * PS003,001... (4 Replies)
Discussion started by: jvoot
4 Replies

10. UNIX for Beginners Questions & Answers

Print number of lines for files in directory, also print number of unique lines

I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with: wc -l *|sort 15263 Image.txt 16401 reference.txt 40459 richtexteditor.txt How can I also print the number of unique lines in each file? 15263 1401 Image.txt 16401... (15 Replies)
Discussion started by: spacegoose
15 Replies
ONEKO(6)							   Games Manual 							  ONEKO(6)

NAME oneko - Creates a cute cat chasing around your mouse cursor.
SYNOPSIS
oneko [-help] [-tora] [-dog] [-sakura] [-tomoyo] [-time n] [-speed n] [-idle n] [-name name] [-towindow] [-toname name] [-tofocus] [-posi- tion geometry] [-rv] [-noshape] [-fg] [-bg] DESCRIPTION
oneko changes your mouse cursor into mouse and creates a little cute cat and the cat start chasing around your mouse cursor. If the cat catchup the ``mouse'', start sleeping. Options -help Prints help message on usage. -tora Make cat into "tora-neko", a cat wite tiger-like stripe. -dog Runs a dog instead of a cat. -sakura Runs Sakura Kinomoto instead of a cat. -tomoyo Runs Tomoyo Daidouji instead of a cat. -time interval Sets interval timer which determine intervals for cat animation. Default value is 125000 and unit is micro-second. Smaller value makes cat run faster. -speed distance Specify the distance where cat jumps at one move in dot resolution. Default is 16. -idle speed Specify the threshold of the speed which ``mouse'' running away to wake cat up. -name name Specify the window name of cat. -towindow When oneko starts with this option, you must select a window by cursor. Then cat appears and starts chasing the window instead of mouse. You can select another running oneko as the target window. If root window is selected, cat chases mouse as usually. When the target window is not in sight and not closed, cat chases mouse as usually. If the target window is closed, this program exit. -toname name Specify the window name of target to make cat chase it instead of mouse. You can specify another running oneko as the target win- dow. When the target window is not in sight and not closed, cat chases mouse as usually. If the target window is closed, this pro- gram exit. -tofocus Makes cat run to and on top of focus window. When focus window is not in sight, cat chases mouse as usually. -position geometry Specify X and Y offsets in pixels to adjust position of cat relative to mouse pointer. -rv Reverse background color and foreground color. -noshape Don't use SHAPE extension. -fg color Foreground color. -bg color Background color. -cursor cursornumber Specify a cursos number to set when quitting. For example, 132 is the default root cursor. Resources Application name is "neko"(or "tora") and class name is "Oneko". tora Set ``True'' if you want "tora-neko". time Sets interval timer in micro-second. speed Sets distance to jump in pixel. idle Sets speed threshold to wake cat up when ``mouse'' running away. noshape Set ``True'' if you don't want to use SHAPE extension. reverse Set ``True'' if you want to switch foreground and background color. foreground Foreground color. background Background color. Notes While this program uses XGetDefault, be sure to use "neko.resouce" form. If you run this program as "tora", by hard of soft link, the -tora option is enabled by default. BSD Daemon Copyright 1988 by Marshall Kirk McKusick. All Rights Reserved. Sakura Kinomoto and Tomoyo Daidouji are characters in a comic strip "CARDCAPTOR SAKURA" (CLAMP, Kodansha), with the sanction indicated in CLAMP SCHOOL WEB CAMPUS (http://www.clamp.f-2.co.jp/). AUTHOR
Original xneko is written by Masayuki Koba and modified to oneko by Tatsuya Kato, and modified furthermore by John Lerchey, Eric Anderson, Toshihiro Kanda and Kiichiroh Mukose. MAINTAINER
Send questions or problems to mukose@hbar.mp.es.osaka-u.ac.jp ONEKO(6)
All times are GMT -4. The time now is 07:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy