11-12-2018
Hi RudiC,
Thanks for the assistance. That works wonderfully. May I ask for some further guidance breaking down the command so I may understand it?
Are we outputting if the current line does not equal the immediately preceding 2 lines (LAST1 || LAST2) and then incrementing the lines for the next iteration?
By extension, this also deals with the type 1 duplicates yes?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
A basic request two files want to combine them but on alternate lines (1 Reply)
Discussion started by: SummitElse
1 Replies
2. Shell Programming and Scripting
Hi,
I'm new to Unix. I want to read the all the lines from a text file and write the alternate lines into another file. Please give me a shell script solution.
file1
-----
one
two
three
four
five
six
seven
newfile(it should contain the alternate lines from the file1)
-------
one... (6 Replies)
Discussion started by: pstanand
6 Replies
3. Shell Programming and Scripting
i have 2 files and i want to compare
i currently cat the files and awk print $1, $2 and doing if file1=file2 then fail, else exit 0
what i want to do is compare values, with column 1 being a reference i want to compare line by line and then still be able to do if then statement to see if worked... (1 Reply)
Discussion started by: sigh2010
1 Replies
4. Shell Programming and Scripting
hi,
i have 2 files.
file1:
1
2
3
4
5
6
file2:
a
b
c
d
e
f
g
h
i (5 Replies)
Discussion started by: vidyaj
5 Replies
5. Shell Programming and Scripting
Hi All,
In continuation of my previous thread 'Add text at the end of line conditionally', I need to further modfiy the file after adding text at the end of the line. Now, I need to add a fixed charater string at alternate lines starting from first line using awk or sed.My file is now as below:... (10 Replies)
Discussion started by: angshuman
10 Replies
6. Shell Programming and Scripting
Hello,
Please help me with this problem if you have a solution.
I have two files:
<file1> : In each line, first word is an Id and then other words that belong to this Id
piMN-1 abc pqr xyz py12
niLM y12 FY4 pqs
fiRLym F12 kite red
<file2> : same as file1, but can have extra lds... (3 Replies)
Discussion started by: mira
3 Replies
7. Programming
Hi,
I need to join every alternate line in a file
for eg:input file
$ cat abc
abc
def
ghi
jkloutput
abc def
ghi jklcode i wrote for this
$ cat add_line.pl
#!/usr/bin/perl -w
my $count=1;
#my $line=undef;
my @mem_line;
my $i=0;
my $x=0; (2 Replies)
Discussion started by: sam05121988
2 Replies
8. UNIX for Dummies Questions & Answers
Total UNIX Rookie, but I'm learning. I have columns of integer data separated by spaces, and I'm using a Mac terminal.
What I want to do:
1. Compare "line 1 column 2" (x) to "line 2 column 2" (y); is y-x>=100?
2. If yes, display difference and y's line number
3. If no, increment x and y by... (9 Replies)
Discussion started by: markymarkg123
9 Replies
9. Shell Programming and Scripting
Hi,
I have a file like
2011|ACC|.*
2013|ACC|.*
2011|ACCC|.*
2013|ACCC|.*
2013|ACCV|.*
2011|ADB|.*
2013|ADB|.*
2011|ADBC|.*
2013|ADBC|.*
2011|AIA|.*
2013|AXJ|.*
2013|NNN|.*
.* represnts any alphanumeric characters after this part of the string
I need a code to return only the... (3 Replies)
Discussion started by: sam05121988
3 Replies
10. Shell Programming and Scripting
hi..
i have a fasta file with the following format
>sequence1
CCGGTTTTCGATTTGGTTTGACT
>sequence2
AAAGTGCCGCCAGGTTTTGAGTGT
>sequence3
AGTGCCGCAGAGTTTGTAGTGT
Now, i want to read alternate line and add "GGGGGGGGGGG" to end of every sequence
Desired output:
>sequence1... (4 Replies)
Discussion started by: empyrean
4 Replies
fmt(1) General Commands Manual fmt(1)
NAME
fmt - format text
SYNOPSIS
width] [file...]
DESCRIPTION
The command is a simple text formatter that fills and joins lines to produce output lines of (up to) the number of characters specified in
the width option. The default width is 72. concatenates the arguments. If none are given, formats text from the standard input.
Blank lines are preserved in the output, as is the spacing between words. does not fill lines beginning with a period for compatibility
with Nor does it fill lines starting with
Indentation is preserved in the output and input lines with differing indentation are not joined (unless is used).
can also be used as an in-line text filter for the command:
reformats the text between the cursor location and the end of the paragraph.
Options
recognizes the following options:
Crown margin mode.
Preserve the indentation of the first two lines within a paragraph and align the left margin of each subsequent line with that
of the second line. This is useful for tagged paragraphs.
Split lines only.
Do not join short lines to form longer ones. This prevents sample lines of code, and other such "formatted" text, from being
unduly combined.
Fill output lines to up to
width columns.
WARNINGS
The width option is acceptable for BSD compatibility, but it may go away in future releases.
SEE ALSO
nroff(1), vi(1).
fmt(1)