Sponsored Content
Full Discussion: Help with uniq -D [prepend]
Top Forums Shell Programming and Scripting Help with uniq -D [prepend] Post 302353792 by eknryan on Wednesday 16th of September 2009 08:39:16 AM
Old 09-16-2009
Thanks Thanhdat!,
The uniq command worked a treat however the AWK prints a 5 line gap between replicate sets. Ive played about with it but cannot reduce this. I am using gawk, would this make a difference?

Is there any way of adding say a string with a count in each blank line i.e line1, line2,line3 etc?

Thanks again
Ryan
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Prepend name of directory to children folders

Hi, I am a shell scripting newbie. I am in need of a shell script that will prepend the name of the parent directory to the child directory. For example if the shell script called rename.sh is invoked with ">rename.sh /home/foobar/Simple" and the structure of the folder Simple is : Simple... (7 Replies)
Discussion started by: kalichar
7 Replies

2. UNIX for Dummies Questions & Answers

prepend columns to a file

I have two files. File 'a' has contents: 1|1 2|2 3|3 4|4 and file 'b' has contents: abc|def hij|klm nop|qrs tuv|wxy I would like to prepend file 'a' to file 'b' (with pipe) such that the contents of 'b' will be: 1|1|abc|def 2|2|hij|klm 3|3|nop|qrs 4|4|tuv|wxy (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

3. Shell Programming and Scripting

prepend and append characters to the same line

Hi, I have a file 'tmp.dat' that contains the below data: 81763 40829 30405 80452 I want to prepend a ' character to the beginning of every line, and I want to append ', at the end of every line. Below is what I expect: '81763', '40829', '30405', '80452', Can anyone help me? ... (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

4. Shell Programming and Scripting

sed prepend text ?

Hi, I have a file with email header information. I would like to change the Subject line. Subject: ** PROBLEM Host Alert: server.domainname is DOWN ** I'd like to change this line such as to look, Subject: serverID ACK Fw: ** PROBLEM Host Alert: server1.domainname is DOWN** How can I... (2 Replies)
Discussion started by: upengan78
2 Replies

5. Shell Programming and Scripting

How to prepend spaces using sed command..?

hi all , i had the below sed command to append header at the starting of my output file .... sed -i -e '1i saikumar suresh hemanth' output.txt i want to append spaces to the Name saikumar how can i append with in this command ....? (1 Reply)
Discussion started by: hemanthsaikumar
1 Replies

6. Shell Programming and Scripting

How to prepend filename to its content without a third file?

Hello, Is possibly there a way to prepend the filename to its content without a third file? The reason is to add a header to each file contents to distinguish each other when they are pasted side-by-side. sample.txt: XLOC_001 0 XLOC_002 23 XLOC_003 4 XLOC_012 6output (with the same... (4 Replies)
Discussion started by: yifangt
4 Replies

7. Shell Programming and Scripting

Prepend text, different matched 1st letters

Prepending lines with: your, the, a or an based on 1st letter match. You'll see my problem below: sed '/^p\|^f\|^c\|^d\|^l/ s/^/your /' list.txt > your.txt && sed '/^v\|^j\|^k\|^m\|^n\|^s/ s/^/the /' your.txt > the.txt && sed '/^b\|^g\|^h\|^q\|^r\|^t\|^w\|^z/ s/^/a /' the.txt > a.txt && sed... (10 Replies)
Discussion started by: p1ne
10 Replies

8. Shell Programming and Scripting

Add number prepend certain lines

from a(depends: ) bb(depends:lmbench ) cc(depends: ) CONFIG_DEFAULT1=y CONFIG_IOSCHED1=y CONFIG_CGROUP1=y ddd(depends: ) CONFIG_GENERIC_CPU1=y CONFIG_CRYPTO_AES_NI1=m to 1. a(depends: ) 2. bb(depends:lmbench ) 3. cc(depends: ) CONFIG_DEFAULT1=y ... (8 Replies)
Discussion started by: yanglei_fage
8 Replies

9. UNIX for Beginners Questions & Answers

Prepend 0 to a field in a record

Hi All, I have a file like below. In the field 9 I am having 14,014,3,001/009 on the records. I want to convert the field to a three digit value. For example 14 should 014 , 3 should 003 11050;11001;;CREDITTRANC;5293218;NRATL;;;11095;;-1;14;3;29=0000;1.25... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
UNIQ(1) 							   User Commands							   UNIQ(1)

NAME
uniq - report or omit repeated lines SYNOPSIS
uniq [OPTION]... [INPUT [OUTPUT]] DESCRIPTION
Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output). With no options, matching lines are merged to the first occurrence. Mandatory arguments to long options are mandatory for short options too. -c, --count prefix lines by the number of occurrences -d, --repeated only print duplicate lines, one for each group -D print all duplicate lines --all-repeated[=METHOD] like -D, but allow separating groups with an empty line; METHOD={none(default),prepend,separate} -f, --skip-fields=N avoid comparing the first N fields --group[=METHOD] show all items, separating groups with an empty line; METHOD={separate(default),prepend,append,both} -i, --ignore-case ignore differences in case when comparing -s, --skip-chars=N avoid comparing the first N characters -u, --unique only print unique lines -z, --zero-terminated line delimiter is NUL, not newline -w, --check-chars=N compare no more than N characters in lines --help display this help and exit --version output version information and exit A field is a run of blanks (usually spaces and/or TABs), then non-blank characters. Fields are skipped before chars. Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use 'sort -u' without 'uniq'. Also, comparisons honor the rules specified by 'LC_COLLATE'. AUTHOR
Written by Richard M. Stallman and David MacKenzie. REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report uniq translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
comm(1), join(1), sort(1) Full documentation at: <http://www.gnu.org/software/coreutils/uniq> or available locally via: info '(coreutils) uniq invocation' GNU coreutils 8.28 January 2018 UNIQ(1)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy