At the cost of readability for AWK newbies, you can minimized that to:
And the shell version to:
It is necessary to disable IFS field splitting to prevent losing leading/trailing whitespace. The -r raw option is required to prevent joining lines that end in backslash with the line that follows. And the $line argument to echo needs to be quoted to prevent the replacing of runs of IFS whitespace with a single space.
Input:
a
b
b
c
d
d
I need:
a
c
I know how to get this (the lines that have duplicates) :
b
d
sort file | uniq -d
But i need opossite of this. I have searched the forum and other places as well, but have found solution for everything except this variant of the problem. (3 Replies)
Greetings,
I want to use a script (preferably awk) which determines if the first character in a line is double-byte (as in Japanese or Chinese) and deletes it.
For example:
(in the above quote, I see Japanese on my screen for two lines - with 2 characters in the first and 3 characters in the... (8 Replies)
I have a textfile containing text similar to the following pattern:
STRING1
UNIQUE_STRING1
STRING2
STRING3
STRING4
STRING5
STRING1
UNIQUE_STRING2
STRING2
STRING3
STRING4
STRING5
STRING1
UNIQUE_STRING3
STRING2
STRING3 (6 Replies)
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)
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
Hello,
I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below).
Example:
one
two
three
four
five
six
seven
eight
I want it to look like: (6 Replies)
i am having a text file like below
rama
surya
pandu
latha
singh
raja
i want to get the new file from 3 to 5
i.e
pandu
latha
singh
please help (1 Reply)
My first post, so don't kill me :)
Say i open some textfile with some example like this.
on the table are handy, bread and wine
Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this:
table
plane ... (3 Replies)
I am very new to to shell scripting and facing a problem that I can't seem to solve. I want to write a bash script that edits file1.txt and saves it as file2.txt.
This is what the files should look like:
file1:
textline1
textline2
startCopy
copyThis
endCopy
textline3
textline4
file2:
... (6 Replies)
Discussion started by: sandy90
6 Replies
LEARN ABOUT PLAN9
vi
VI(1) General Commands Manual VI(1)NAME
vi, ki, xi - instruction simulators
SYNOPSIS
vi [ textfile ]
vi pid
ki [ textfile ]
ki pid
xi [ textfile ]
xi pid
DESCRIPTION
Vi simulates the execution of a MIPS binary in a Plan 9 environment. It has two main uses: as a debugger and as a statistics gatherer.
Programs running under vi execute about two hundred times slower than normal--but faster than single stepping under db. Ki and xi are sim-
ilar to vi but interpret SPARC and ATT3210 binaries. The following discussion refers to vi but applies to the others as well.
Vi will simulate the execution of a named textfile. It will also make a copy of an existing process with process id pid and simulate its
continuation.
As a debugger vi offers more complete information than db(1). Tracing can be performed at the level of instructions, system calls, or
function calls. Vi allows breakpoints to be triggered when specified addresses in memory are accessed. A report of instruction counts,
load delay fills and distribution is produced for each run. Vi simulates the CPU's caches and MMU to assist the optimization of compilers
and programs.
The command interface mirrors the interface to db; see db(1) for a detailed description. Data formats and addressing are compatible with
db except for disassembly: vi offers only MIPS (db -mmipsco) mnemonics for machine instructions. Ki offers both Plan 9 and Sun SPARC for-
mats.
Several extra commands allow extended tracing and printing of statistics:
$t[0ics]
The t command controls tracing. Zero cancels all tracing options.
i Enable instruction tracing
c Enable call tracing
s Enable system call tracing
$i[itsp]
The i command prints statistics accumulated by all code run in this session.
i Print instruction counts and frequency.
p Print cycle profile.
t (Vi only) Print TLB and cache statistics.
s Print memory reference, working set and size statistics.
:b[arwe]
Vi allows breakpoints to be set on any memory location. These breakpoints monitor when a location is accessed, read, written, or
equals a certain value. For equality the compared value is the count (see db(1)) supplied to the command.
SOURCE
/sys/src/cmd/vi etc.
SEE ALSO nm(1), db(1)BUGS
The code generated by the compilers is well supported, but some unusual instructions are unimplemented. Some Plan 9 system calls such as
rfork cause simulated traps. The floating point simulation makes assumptions about the interpreting machine's floating point support. The
floating point conversions performed by vi may cause a loss of precision.
VI(1)