Sponsored Content
Top Forums Shell Programming and Scripting how many unique lines in a file Post 302355766 by danmero on Wednesday 23rd of September 2009 04:44:19 PM
Old 09-23-2009
Only awk
Code:
awk '{a[$0]++}END{print length(a)}' file

 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

Comparing 2 files and return the unique lines in first file

Hi, I have 2 files file1 ******** 01-05-09|java.xls| 02-05-08|c.txt| 08-01-09|perl.txt| 01-01-09|oracle.txt| ******** file2 ******** 01-02-09|windows.xls| 02-05-08|c.txt| 01-05-09|java.xls| 08-02-09|perl.txt| 01-01-09|oracle.txt| ******** (8 Replies)
Discussion started by: shekhar_v4
8 Replies

3. Shell Programming and Scripting

get part of file with unique & non-unique string

I have an archive file that holds a batch of statements. I would like to be able to extract a certain statement based on the unique customer # (ie. 123456). The end for each statement is noted by "ENDSTM". I can find the line number for the beginning of the statement section with sed. ... (5 Replies)
Discussion started by: andrewsc
5 Replies

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

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. Shell Programming and Scripting

Change unique file names into new unique filenames

I have 84 files with the following names splitseqs.1, spliseqs.2 etc. and I want to change the .number to a unique filename. E.g. change splitseqs.1 into splitseqs.7114_1#24 and change spliseqs.2 into splitseqs.7067_2#4 So all the current file names are unique, so are the new file names.... (1 Reply)
Discussion started by: avonm
1 Replies

7. Shell Programming and Scripting

compare 2 files and return unique lines in each file (based on condition)

hi my problem is little complicated one. i have 2 files which appear like this file 1 abbsss:aa:22:34:as akl abc 1234 mkilll:as:ss:23:qs asc abc 0987 mlopii:cd:wq:24:as asd abc 7866 file2 lkoaa:as:24:32:sa alk abc 3245 lkmo:as:34:43:qs qsa abc 0987 kloia:ds:45:56:sa acq abc 7805 i... (5 Replies)
Discussion started by: anurupa777
5 Replies

8. Shell Programming and Scripting

Combine multiple unique lines from event log text file into one line, use PERL or AWK?

I can't decide if I should use AWK or PERL after pouring over these forums for hours today I decided I'd post something and see if I couldn't get some advice. I've got a text file full of hundreds of events in this format: Record Number : 1 Records in Seq : ... (3 Replies)
Discussion started by: Mayday22
3 Replies

9. Shell Programming and Scripting

Transpose lines from individual blocks to unique lines

Hello to all, happy new year 2013! May somebody could help me, is about a very similar problem to the problem I've posted here where the member rdrtx1 and bipinajith helped me a lot. https://www.unix.com/shell-programming-scripting/211147-map-values-blocks-single-line-2.html It is very... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

10. 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
APPROX(8)						      System Manager's Manual							 APPROX(8)

NAME
approx - proxy server for Debian archive files SYNOPSIS
approx [OPTION]... DESCRIPTION
approx responds to HTTP requests made by apt-get(8). It maintains a cache of Debian archive files that have been previously downloaded, so that it can respond with a local copy when possible. If a file not in the cache is requested, approx will download it from a remote Debian repository and deliver the contents to the client, simultaneously caching it for future use. Over time, the approx server cache will grow to contain multiple, unneeded versions of Debian packages. The approx-gc(8) program removes these from the cache. OPTIONS
-c file, --config file Specify an additional configuration file. May be used multiple times. USAGE
approx is invoked by inetd(8). EXAMPLES
Suppose that a client machine's /etc/apt/sources.list file contains the following lines: deb http://apt:9999/debian testing main deb http://apt:9999/security testing/updates main deb-src http://apt:9999/debian unstable main In this example, apt is the hostname of the approx server machine on the local network. Each distribution, such as "debian" or "security", is mapped to a remote repository in the approx server's configuration file. For example, the approx.conf file on the approx server might contain the lines debian http://ftp.debian.org/debian security http://security.debian.org The mapping scheme is very simple. If the approx.conf file contains the line repository http://remote-host/initial/path then any request to the approx server of the form http://approx-server/repository/rest/of/URL is rewritten to http://remote-host/initial/path/rest/of/URL when there is a "cache miss", and that file is cached as /var/cache/approx/repository/rest/of/URL (Note that the repository name on the left-hand side is not included in the rewritten URL unless it is explicitly mentioned in the right- hand side's initial path.) FILES
/etc/approx/approx.conf Configuration file for approx and related programs. /var/cache/approx Default cache directory for archive files. SEE ALSO
approx.conf(5), inetd(8), approx-import(8), approx-gc(8), apt-get(8), sources.list(5) AUTHOR
Eric Cooper <ecc@cmu.edu> May 2011 APPROX(8)
All times are GMT -4. The time now is 10:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy