Sponsored Content
Top Forums Shell Programming and Scripting awk : extracting unique lines based on columns Post 302417841 by pseudocoder on Saturday 1st of May 2010 02:25:17 AM
Old 05-01-2010
Quote:
Originally Posted by itkamaraj
please explain the logic

what is a !~ $2

please explain the logic


thanks
kamaraj
Nope Smilie
I've found it on the net some time ago and it simply emulates uniq, applied on the 2nd column.
Create a testfile with following content and play with it, try $0, $1, and $2 and see the difference:
Code:
abc 000
abc 123
abc 123
sdf 234
fds 234
jkl 999
lkj 222
lkj 222
qwe 443
rew 323

genehunter,
how can you know that it didn't work? Just because our results differ?
I guess without having the original file it will be hard to find the error.
You will have to copy out e.g. the first 500 lines off the datafile in a tempfile and see if the results differ.
Maybe you can then attach that tempfile to your posting, so we all can examine it and try to find the error (if there is any Smilie)
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

extracting unique lines from text file

I have a file with 14million lines and I would like to extract all the unique lines from the file into another text file. For example: Contents of file1 happy sad smile happy funny sad I want to run a command against file one that only returns the unique lines (ie 1 line for happy... (3 Replies)
Discussion started by: soliberus
3 Replies

3. Shell Programming and Scripting

Extracting Text Between Two Unique Lines

Hi all! Im trying to extract a portion of text from a file and put it into a new file. I need all the lines between <Placement> and </Placement> including the Placemark lines themselves. Is there a way to extract all instances of these and not just the first one found? I've tried using sed and... (4 Replies)
Discussion started by: Grizzly
4 Replies

4. Shell Programming and Scripting

Extracting several lines of text after a unique string

I'm attempting to write a script to identify users who have sudo access on a server. I only want to extract the ID's of the sudo users after a unique line of text. The list of sudo users goes to the EOF so I only need the script to start after the unique line of text. I already have a script to... (1 Reply)
Discussion started by: bouncer
1 Replies

5. UNIX Desktop Questions & Answers

Extracting only unique data between two columns

:wall:Hi there, I am trying to extract/filter a unique data between specific columns from a tab deliminated file, that has a number of columns: input file as follow: 5 rs1 70 A C 7 1 1 Blue 5 rs9 66 A E ... (2 Replies)
Discussion started by: houkto
2 Replies

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

7. Shell Programming and Scripting

count the unique records based on certain columns

Hi everyone, I have a file result.txt with records as following and another file mirna.txt with a list of miRNAs e.g. miR22, miR123, miR13 etc. Gene Transcript miRNA Gar Nm_111233 miR22 Gar Nm_123440 miR22 Gar Nm_129939 miR22 Hel Nm_233900 miR13 Hel ... (6 Replies)
Discussion started by: miclow
6 Replies

8. Shell Programming and Scripting

Find unique lines based off of bytes

Hello All, I have two VERY large .csv files that I want to compare values based on substrings. If the lines are unique, then print the line. For example, if I run a diff file1.csv and file2.csv I get results similar to +_id34,brown,car,2006 +_id1,blue,train,1985... (5 Replies)
Discussion started by: jl487
5 Replies

9. Shell Programming and Scripting

Remove lines with unique information in indicated columns

Hi, I have the 3-column, tab-separated following data: dot is-big 2 dot is-round 3 dot is-gray 4 cat is-big 3 hot in-summer 5 I want to remove all of those lines in which the values of Columns 1 and 2 are identical. In this way, the results would be as follows: dot is-big 2 cat... (4 Replies)
Discussion started by: owwow14
4 Replies

10. Linux

To get all the columns in a CSV file based on unique values of particular column

cat sample.csv ID,Name,no 1,AAA,1 2,BBB,1 3,AAA,1 4,BBB,1 cut -d',' -f2 sample.csv | sort | uniq this gives only the 2nd column values Name AAA BBB How to I get all the columns of CSV along with this? (1 Reply)
Discussion started by: sanvel
1 Replies
FS_SETVOL(1)						       AFS Command Reference						      FS_SETVOL(1)

NAME
fs_setvol - Set quota and messages for a volume containing a file or directory SYNOPSIS
fs setvol [-path <dir/file path>+] [-max <disk space quota in 1K units>] [-offlinemsg <offline message>] [-help] fs setv [-p <dir/file path>+] [-ma <disk space quota in 1K units>] [-o <offline message>] [-h] fs sv [-p <dir/file path>+] [-ma <disk space quota in 1K units>] [-o <offline message>] [-h] DESCRIPTION
The fs setvol command sets the quota (maximum possible size) of the read/write volume that contains each directory or file named by the -path argument. To associate a message with the volume which then appears in the output of the fs examine command, include the -offlinemsg argument. To display all of the settings made with this command, use the fs examine command. The fs listquota command reports a fileset's quota, and the fs quota command the percent of quota used. To set quota on one volume at a time, use the fs setquota command. CAUTIONS
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes). OPTIONS
-path <dir/file path>+ Names each file or directory for which to set the host volume's quota and offline message. Partial pathnames are interpreted relative to the current working directory, which is also the default value if this argument is omitted. Specify the read/write path to the file or directory, to avoid the failure that results from attempting to change a read-only volume. By convention, the read/write path is indicated by placing a period before the cell name at the pathname's second level (for example, /afs/.abc.com). For further discussion of the concept of read/write and read-only paths through the filespace, see the fs mkmount reference page. -max <disk space quota in 1K units> Sets the maximum amount of file server disk space the volume can occupy. Provide a positive integer to indicate the number of one- kilobyte blocks (1024 is one megabyte). A value of 0 sets an unlimited quota, but the size of the disk partition that houses the volume places an absolute limit on the volume's size. If the -path argument is omitted (so that the command sets the quota of the volume housing the current working directory), the -max switch must be provided. -offlinemsg Associates a message with the volume which then appears in the output of the fs examine command. Its intended use is to explain why the volume is currently offline. -help Prints the online help for this command. All other valid options are ignored. EXAMPLES
The following command imposes a 6500 kilobyte quota on the volumes mounted at the home directories /afs/abc.com/usr/smith and /afs/abc.com/usr/pat: % cd /afs/abc.com/usr % fs setvol -path smith pat -max 6500B<> PRIVILEGE REQUIRED
The issuer must belong to the system:administrators group. SEE ALSO
fs_examine(1), fs_listquota(1), fs_mkmount(1), fs_quota(1), fs_setquota(1) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 FS_SETVOL(1)
All times are GMT -4. The time now is 11:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy